The IP Geolocation API custom tag template is an unofficial tag template for Google Tag Manager’s community template gallery.

Vendor documentation
Blog post
Gallery entry
GitHub repo


This template loads a JavaScript library from IP Geolocation API. This JavaScript library is automatically compiled to geolocate the user based on their IP address (or a custom IP address if you so choose). This information is then pushed into dataLayer for you to use.

The API can also be used to derive things like ISP data.

The API has a generous free tier, and the template includes the option of caching the information in browser storage to avoid making too many calls to the API.

See the API documentation and my accompanying blog post for more information on how the template can be used.

Release notes

Date Changeset
25 April 2020 Fix the latest update. Utilize API without jQuery. Use sessionStorage to cache results.
6 April 2020 Update to latest version of the API.
10 February 2020 Add IP hashing as an option.
3 January 2020 Initial release.