User Geolocation Data Layer Examples
Learn more about how ListenLayer generates powerful data layers from the activity on your website, specifically based on the visitor’s location.
Custom Data Layer Events
The User Geolocation Listener automatically pushes an event called “userGeolocation” whenever a website visitor begins a session on your website. You can capture this event and use it as a trigger inside Google Tag Manager. You can also use ListenLayer to store the user’s location in the browser and use it during future data layer activities.
event: 'userGeolocation'
Automatic Data Layer Values
Along with the custom event above, ListenLayer provides extensive details about the user’s location in the data layer. You can choose to use some or all of these variables in your strategy.
Detailed location information includes:
- City
- Continent (name and abbreviation)
- Country (name and abbreviation)
- DMA Code and Name
- Latitude & Longitude
- Postal Codes
- State and Regions (name and abbreviation)
- The Nearest Populated Place
- Local currency (symbol, code, and conversion rate to USD)
- The user’s IP address
- Quantified Indicator of Location Accuracy
A data layer example is shown to the right
We support location data across the entire world!
ugAutomaticValues: {
geography: {
latitude: 39.4895,
longitude: -104.8447,
continentName: "North America",
continentCode: "NA",
countryName: "United States",
countryCode: "US",
regionName: "Colorado",
regionCode: "CO",
city: "Parker",
postalcode: 80134,
dmaName: "Denver",
dmaCode: 751,
nearestPopulatedPlace: "Meridian",
timezone: "UTC-07:00(America/Denver)"
},
currency: {currencyCode: "USD", currencySymbol: "$", convertTo1USD: 1},
userIP: "98.38.44.163",
locationAccuracyRadius: 10,
ugLocation: {
url: "https://demo.hostedstaging.com/?gtm_debug=1640120420011",
tld: "hostedstaging.com",
hostname: "demo.hostedstaging.com",
pathname: "/",
queryString: "?gtm_debug=1640120420011",
parameters: {gtm_debug: 1640120420011},
fragment: null,
protocol: "https",
originPathName: "https://demo.hostedstaging.com/"
}
}
Custom Data Layer Values
ListenLayer allows you to write rules to generate custom data inside your data layer. For example, use information about the user’s location to power additional details that can be used in your measurement strategy.
In this example, we’ve identified regions belonging to our Tier 1 strategy inside of ListenLayer. By pushing this value into the data layer, we can capture aggregate information about our visitor’s location in relation to our advertising strategy. We can even use this to completely filter out data from countries or regions that we do not want to measure.
ugCustomValues: {
//custom variable values display here based on rules you write
locationTier: 'Tier 1 Location'
},
Store Visitor Location in the Browser
ListenLayer allows you to write rules to store data from your data layer into the browser (cookies, local storage, or session storage). Use this to capture specific location details and use them in the future as the user browses the website or returns in the future.
Push data from browser storage back into the data layer during any future data layer event!
Ready to Dive In?
See how easy (and powerful) ListenLayer is by opening an account today or requesting a demo.