A couple of days ago, I was analyzing a dataset and I realized that some company’s internal people are clicking on remarketing banners without knowing that the company is paying for every single click.
After some further analysis, I find out that they are mainly using a specific internet service provider (ISP) – and that’s why I decided to block the remarketing pixels using a Google Tag Manager trigger.
1 How to get the ISP name
I did some research and I found a freemium API called extreme-ip-lookup.com that is providing multiple information about the visitor. FYI – in this guide, I’ll explain how to collect the ISP name but with the same procedure you could also get the IP address, location,… .
Let’s implement the APIs in GTM! First of all, you have to copy the code you find below:
1 2 3 4 5 6 |
<script> function getIP(json) { dataLayer.push({"event":"ispEvent","ispName" : json.isp}); } </script> <script src="//extreme-ip-lookup.com/json/?callback=getIP" async defer></script> |
The script queries the APIs and push the ISP name into the data layer.
Open your Google Tag Manager account and create a Custom HTML tag. Then you have to paste the code and choose an All Pages trigger.
2 Push the ISP name into a GTM Variable
Now go to Variables and create a new Data Layer Variable called ispName. This variable will contain the Internet Service Provider name that you’ll get from the APIs.
Launch the preview mode and open your website and Google Tag Manager will load the debug window. Click on Data Layer and here you should see the ispName and the name of your ISP.
3 The trigger
The trigger – is the last thing you have to create. Go to Triggers and create a new Page View – Window Loaded trigger. Select Some Window Loaded Events and choose the data layer variable. Now you have to define the firing conditions and publish the changes.
I hope that this tutorial was helpful for you as well and let me know if you find a different API with higher requests quota 😀