- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog TLC Blog
- Support Desk Support Desk
This article describes how to incorporate geolocation API services into Tealium iQ.
This article covers the following topics:
With real-time geolocation services, you can locate and identify website visitors via their IP address. Here is a list of several geolocation services:
Please note: These are third-party vendors and not affiliated with Tealium in any way. Setting up and configuring any third-party geolocation service is the sole responsibility of the client.
We are using the Tealium Generic Tag to load the geolocation service, a custom JavaScript code extension to parse the geolocation results, and new data layer variables to store the geolocation data and use it in the Tealium iQ configuration.
In this example, using ipstack, the geolocation results are parsed in a callback function. This function will be defined in a JavaScript Code extension and the name of the function will be passed to ipstack as a querystring parameter. The ipstack tag knows to call this function automatically.
Each geolocation service might use a different mechanism for triggering the callback.
Once the geolocation is parsed there are a couple options for how to proceed. You could make a tracking call (presumably to pass data to AudienceStream to update visitor records) or save the data in localStorage for use client-side.
In Tealium iQ, create a Tealium Generic Tag with the following configuration settings (leaving other settings as default values)
http://api.ipstack.com/check
access_key=ACCESSKEY&callback=utag.ut.parse_geo
utag.ut.parse_geo
. The following example determines the customer's location information.var geo={};
geo.tealium_event="geo";
utag.ut.parse_geo = function(data) {
if (data && typeof data == "object" && data != {}) {
geo.geo_city = (data.city) ? data.city : "N/A";
geo.geo_state = (data.region_code) ? data.region_code : "N/A";
geo.geo_country_code = (data.country_code) ? data.country_code : "N/A";
geo.geo_location = geo.geo_city + ", " + geo.geo_state;
// make a tracking call or just save the data to localStorage
utag.link(geo);
}
};
Create any variables that you may need in the Data Layer tab, such as:
geo_city
: geolocation citygeo_state
: geolocation stategeo_country_code
: geolocation country codegeo_location
: combination of geolocation city and stateClick Save/Publish when you have completed setting up your GeoLocation custom tag.
For a use case of using geolocation services, check out Advertising Against Weather Forecast to target website visitors based on their weather forecast. The video shows how to combine the geolocation service tag with ad targeting using AudienceStream.
Copyright All Rights Reserved © 2008-2021