Skip to content
Facebook Twitter Github RSS
Google Tag Manager for WordPress
  • Home
  • FeaturesExpand
    • Basic features of GTM4WP

      You can use many post or page attribute in you Google Tag Manager setup even for custom post types and taxonomies.

      Basic data

      Page / post attributes

      Site search

      User data

      Multisite data

      3rd party data

      Browser attributes

      Device attributes

      Operating system attributes

      Weather conditions

  • SetupExpand
    • Setup advanced GTM4WP features

      Integrate your measurement with WooCommerce, setup Google Analytics 4, Google Ads remarketing or conversion tracking maximizing capabilities.

      WooCommerce related

      Google Analytics 4

      Google Ads – Dynamic Remarketing

      Google Ads – Conversion tracking

      Google Ads – Enhanced Conversions

      Other setup articles

      Exclude WordPress admins

      Embedded media players

  • DevelopersExpand
    • Information for developers and WP managers

      There are several tools in GTM4WP to support your special needs and to adjust plugin behavior to your website or WooCommerce shop.

      Do you want to contribute with a bugfix or a new feature? Visit the GTM4WP’s GitHub page!

      For Developers

      Actions and filters

      WP themes + Proper ecommerce tracking

      For WP managers

      Setup GTM Environments

      Hard code GTM parameters

  • Blog
  • GDPR
Download
Google Tag Manager for WordPress
Home / Use special 3rd party data in Google Tag Manager / Track country, city and other geo data of the current visitor

Track country, city and other geo data of the current visitor

Google Tag Manager for WordPress can add various geo data into the data layer about your current visitor. Depending on your website’s traffic, additional fees may apply IP Stack. There is one exception in the list of variables: geoCloudflareCountryCode does not require to use IP Stack and has a separate checkbox in plugin option to activate. See details below.

You can place a cookie named block_gtm4wp_geoip into the browser of your visitor to prevent the GeoIP usage in the browser for that particular user. This is useful as the IP address of your site visitor will be shared with those 3rd party services and it is a good practice to get consent from the user to do that. If the user denies the consent, create the block_gtm4wp_geoip cookie using any of the following values: "yes", "true", "on" or "1".

Once API keys have been set in GTM4WP plugin options (you can obtain the keys by registering for a free or paid plan at IP Stack), the following data layer variables will be available:

  • geoFullGeoData
  • geoCountryCode
  • geoCloudflareCountryCode
  • geoCountryName
  • geoRegionCode
  • geoRegionName
  • geoCity
  • geoZipcode
  • geoLatitude
  • geoLongitude

geoFullGeoData

The full API response of IP Stack. Available data is listed in the IP Stack documentation.

geoCountryCode

If you just need the country code from geoFullGeoData, you can use this data layer variable. It uses ISO-3166-1 codes.

geoCloudflareCountryCode

This data layer variable is an exception from the other variables: if your site is protected by Cloudflare, you can access the country code provided by Cloudflare in the HTTP headers. To use this option, you need to turn on a separate option in GTM4WP and you do not need to use IP Stack.

geoCountryName

If you just need the country name from geoFullGeoData, you can use this data layer variable..

geoRegionCode

If you just need the region code from geoFullGeoData, you can use this data layer variable (e.g. CA for California).

geoRegionName

If you just need the region name from geoFullGeoData, you can use this data layer variable (e.g. California).

geoCity

If you just need the name of the city from geoFullGeoData, you can use this data layer variable.

geoZipcode

If you just need the zipcode from geoFullGeoData, you can use this data layer variable.

geoLatitude

If you just need the latitude attribute from geoFullGeoData, you can use this data layer variable.

geoLongitude

If you just need the longitude attribute from geoFullGeoData, you can use this data layer variable.

© 2025 Google Tag Manager for WordPress - Privacy policy

  • WordPress.org plugin page
  • Plugin support
  • Plugin reviews
Cookies are not evil
This website may use cookies to remember your log-in details, to optimize site functionality for your use, and deliver marketing based on your interests.

This does not include collecting any personal data of you. In any case we need to process any of your personal data, we will ask for your specific consent later for sure.

Accepting this message only means that we will be able to analyze site content performance using larger buckets of users and to deliver tailored messages to those user buckets. We will be not able to analyze your activity alone especially not in a way where your name or any personal data of you is attached to this analysis.

Accept Settings
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-*1 yearUsed by the cookie consent manager of this website to remember your choice of cookie usage.
gtm4wp_last_weatherstatusend of user sessionUsed by a plugin of this WordPress website to dump debug related non-personal data about the weather data identified during your site visit.
Advertising
Tracking codes that could be used to tailor our messages based on your interests. This does not mean that we will be able to track your activities alone especially not in a way that would allow us to connect your name or other personal data to your website activities.
Statistical
Tracking of website usage without using any feature that would involve personal data processing either by us or by our tracking vendor. This includes IP address anonymization and disabling features related to interest based advertising.
Save & Accept
  • Home
  • Features
    • Basic features of GTM4WP

      You can use many post or page attribute in you Google Tag Manager setup even for custom post types and taxonomies.

      Basic data

      Page / post attributes

      Site search

      User data

      Multisite data

      3rd party data

      Browser attributes

      Device attributes

      Operating system attributes

      Weather conditions

  • Setup
    • Setup advanced GTM4WP features

      Integrate your measurement with WooCommerce, setup Google Analytics 4, Google Ads remarketing or conversion tracking maximizing capabilities.

      WooCommerce related

      Google Analytics 4

      Google Ads – Dynamic Remarketing

      Google Ads – Conversion tracking

      Google Ads – Enhanced Conversions

      Other setup articles

      Exclude WordPress admins

      Embedded media players

  • Developers
    • Information for developers and WP managers

      There are several tools in GTM4WP to support your special needs and to adjust plugin behavior to your website or WooCommerce shop.

      Do you want to contribute with a bugfix or a new feature? Visit the GTM4WP’s GitHub page!

      For Developers

      Actions and filters

      WP themes + Proper ecommerce tracking

      For WP managers

      Setup GTM Environments

      Hard code GTM parameters

  • Blog
  • GDPR
Search