Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can You Trigger a Tag Based on Region in Google Tag Manager?

Is it possible to fire a tag from Google Tag Manager, using the location of a web visitor as the trigger? I'm asking specifically in regards to wanting to fire an EU cookie notification, but only have it appear to visitors from the EU.

Ideally, I would be able to set-up this up in GTM. If it is possible, can someone please explain how to do it?

Thanks so much!

like image 771
dpayne Avatar asked May 31 '16 17:05

dpayne


People also ask

Does Google Tag Manager require global site tag?

We recommend installing either Global Site Tag or Google Tag Manager, but not both simultaneously, as they have the same general function. If you are already using Google Tag Manager, you won't need to install Global Site Tag, and vice versa.

What is the difference between a tag and a trigger in Google Tag Manager?

Tag: A tag is code that send data to a system such as Google Analytics. Trigger: A trigger listens for certain events, such as clicks, form submissions, or page loads. When an event is detected that matches the trigger definition, any tags that reference that trigger will fire.

Is Google Tag Manager going away?

But it looks like Google Tag Manager isn't going away anytime soon: its popularity is growing, more and more people are using it as their work tool, the number of free and paid GTM resources is also constantly increasing.


1 Answers

GTM itself cannot determine the location of the user. But of course you can use a custom HTML tag with a script to determine location, either via the geolocation API (which will require the users permission) or via a third party service that allows you to resolve IP addresses via a Javascript API (these service are usually commercial, plus it's expensive in terms of browser resources).

It would be much better for page performance to resolve the IP serverside to a location and push the location to the dataLayer. Then you could trigger or block your tags depending on location. To be legally on the safe side you should anonymize the IP before you use it for geolocation by setting the last tuple to 000 - that will be exact enough to determine if the user falls under EU jurisdiction while obscured enough to not constitute personally identifiable data.

like image 95
Eike Pierstorff Avatar answered Nov 15 '22 08:11

Eike Pierstorff