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!
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With