Every website that loads a Google tag container also receives a coded note of where Google thinks the visitor is, and a few lines of JavaScript can read it, according to a post published on November 10, 2026 by analytics developer David Vallejo on his Thyngster blog.

The post sets out three Google Tag Manager variables that pull the visitor's country, region and a true-or-false flag for areas covered by the European Union's Digital Markets Act out of an object that Google's tag code leaves in the browser: window.google_tag_data.xcd.ip_geo_data_cache. No request to an outside geolocation provider is involved. The catch is one Vallejo states himself. The object is "an internal Google Tag implementation detail" rather than a documented interface, and "Its availability and data structure may change without notice."

In Short

Google's tag code carries a record of each visitor's country, region and Digital Markets Act status, and on November 10, 2026, analytics developer David Vallejo published three Tag Manager variables that read it straight from the page. That matters to anyone who fires marketing tags or applies consent rules by location, because the same location data Google uses to route and regulate its own tags becomes available without a paid lookup service. Google has not documented the object, so any setup built on it depends on code Google can change at any time.

What the post found

Tag Manager containers are not static files. According to Vallejo, Google Tag containers, Tag Manager included, "are served dynamically because the generated code may contain configuration settings specific to the container ID being used." Part of what Google assembles on each request, he wrote, is an encoded string holding the visitor's geolocation. The string is stored in base64, a text encoding that browsers can reverse with the standard JavaScript function atob(). A screenshot in the post shows it sitting as entry 22 in a numbered list of values inside the container code, between the entries for www.googletagmanager.com and google.tagmanager.debugui2.queue. Decoded by PPC Land, the string in that screenshot describes a visitor in France, with the values FR, FR-HDF (the Hauts-de-France region) and google.fr among its fields.

How long has this been going on? Vallejo dates it to at least June 13, 2022, the earliest point at which, by his account, Google was geolocating users on its tagging infrastructure. According to the post, the geolocation was originally introduced to support Google's Regional Data Collection requirements, which he identifies with the region1 collection endpoints, written in the post as "region1.*". He gives two reasons for the practice. One is plumbing: "Google needs to know a user's country to route data collection requests to the appropriate regional endpoint." The other is regulation. According to the post, the location lets Google apply the GDPR, the Digital Markets Act and Global Privacy Control, the browser signal that asks websites not to pass a visitor's personal information on to advertisers. Region matters as well as country, the post notes, because some of those rules apply at the level of a region rather than a whole country.

Nobody has to dig the string out of the container by hand. Vallejo wrote that "for at least the past couple of years, Google Tags have exposed this information through a publicly accessible function": window.google_tag_data.xcd.ip_geo_data_cache.get(). That function returns text, which his code parses as JSON before reading three numbered keys from the result.

The three variables

The post publishes three variables for Tag Manager. They differ only in the key they read.

Variable name Key read from the parsed data What it returns, according to the post Example values in the post
get_country '0' Country code (ISO 3166-1) ES, JP
get_region '1' Region code ES-MC, JP-13
is_dma_region '6' Whether the visitor is in a region affected by the Digital Markets Act true, false

The region examples follow the ISO 3166-2 standard for country subdivisions: ES-MC is the Region of Murcia in Spain, JP-13 is Tokyo.

What the decoded data holds

The post also shows a decoded example in full, as an image of an encoded string next to the JSON it produces. That example holds eight keys, numbered 0 to 6 and 9. The variables use three of them. The post does not explain the other five.

Key Value in the post's decoded example What the post says about it
"0" "ES" Country code, read by get_country
"1" "ES-MC" Region code, read by get_region
"2" false Not explained
"3" "google.es" Not explained
"4" "region1" Not explained
"5" false Not explained
"6" true DMA region flag, read by is_dma_region
"9" true Not explained

Two details stand out. The value of key "4", region1, carries the same name as the collection endpoints the post ties to Regional Data Collection. And keys "7" and "8" are absent from the example. The French string in the container screenshot, decoded by PPC Land, has exactly the same eight keys, with false, region1, false, true and true in keys 2, 4, 5, 6 and 9.

The country variable, as published in the post, reads:

function get_country() {
  try {
    var geo = JSON.parse(window.google_tag_data.xcd.ip_geo_data_cache.get());
    return geo['0'];
  } catch (e) {
    return undefined;
  }
}

The region and DMA functions are identical except for the key: geo['1'] and geo['6']. Each wraps the lookup in a try-catch block, so a missing object or unreadable text produces undefined rather than a script error.

One limit comes from Tag Manager itself. Custom templates, the sandboxed format Tag Manager offers for building reusable tags and variables, cannot reach the object. "Access to window.google_tag_data is not allowed from Templates," Vallejo wrote, which is why the three functions are written as plain custom JavaScript variables.

How the method works, according to the post

According to Vallejo, the method has five parts.

  1. Google serves each Google tag or Tag Manager container dynamically for its container ID, and the served code includes a base64-encoded string with the visitor's geolocation.
  2. In a browser where a Google tag has loaded, the global object window.google_tag_data exposes xcd.ip_geo_data_cache.get(), which returns the cached geolocation data as text.
  3. A custom JavaScript variable in Tag Manager runs JSON.parse() on that text.
  4. The variable returns a single key: '0' for the country code, '1' for the region code or '6' for the DMA flag.
  5. If the object is absent or the text cannot be parsed, the variable returns undefined.

The values can then feed triggers. In Vallejo's words, "This allows us to trigger pixels and apply location-based logic according to the user's geographic location, much like Google does internally."

What Google's documentation says

None of the public Google pages reviewed for this article mentions ip_geo_data_cache. Several of them do describe the location logic that the post refers to, and they support its broad outline.

Consent defaults by region. Google's developer guide to setting up consent mode on websites says a region can be set "according to ISO 3166-2" in the gtag consent default command. Its example sets analytics_storage to denied for ['ES', 'US-AK'], Spain and Alaska, and uses a second command to set ad_storage to denied for all visitors. When a country-level and a subdivision-level default overlap, "the one with a more specific region will take effect." That is the same code format the post's region variable returns. To choose between such defaults, the Google tag has to know where the visitor is. The guide does not say how it finds out.

Analytics routing. Google Analytics' help page on regional data collection, the feature Vallejo names as the original reason for the geolocation, states that "IP addresses are used to determine the optimal local data center." Its page on EU, Swiss and UK data adds: "When Analytics collects measurement data, all IP lookups are performed on EU, Switzerland, or UK-based servers". It also says that "Google Analytics does not log or store individual IP addresses from EU, Switzerland, or UK users." Both statements are consistent with Vallejo's account of location being resolved inside Google's own collection system and used to pick a regional endpoint.

Server-side Tag Manager. Google's guide to enabling region-specific behavior for tags in server-side Tag Manager, last updated on July 30, 2026, opens with a recommendation: "We recommend enabling region-specific behavior for tags to unlock features such as advanced consent mode". Sites that serve gtm.js or gtag.js from their own domain have to pass location to the tagging server in request headers, and the guide sets the format for subdivision values: "The format has to adhere to ISO-3166-2." On priority, it states: "If available in the request header, IP address takes precedence in determining geolocation." When the scripts are loaded from www.googletagmanager.com instead, according to the guide, the request carries the user's IP address and geolocation information, but only the geolocation information is used.

Tag gateway. Google's help page on how its tag gateway for advertisers sets location spells out the dependency most plainly. In a standard setup, according to Google, location is inferred from the visitor's IP address. Behind the gateway, which routes Google's tags through the advertiser's own domain, Google sees the IP address of the advertiser's content delivery network instead, so the network has to pass the visitor's location along in headers. Without them, Google says, region detection can be inaccurate, which affects reports and the region-specific defaults in consent mode. The page also says Google Analytics traffic from the European Economic Area goes directly to regional Google endpoints, bypassing the CDN path, while Google Ads conversion hits still pass through the gateway.

Location headers named in Google's documentation

Setup Header or setting Google page
Tag gateway, manual setups (preferred) X-Forwarded-CountryRegion, ISO 3166-2 format, for example US-CA How Google tag gateway for advertisers sets location
Tag gateway, manual setups (alternative) X-Forwarded-Country (ISO 3166-1 alpha-2) plus X-Forwarded-Region Same page
Tag gateway, optional X-Forwarded-Geolocation (latitude, longitude, city) Same page
Tag gateway through Google Cloud Load Balancer X-Forwarded-Country and X-Forwarded-Region, added by the integration Same page
Tag gateway through Cloudflare Visitor location headers, enabled by the integration Same page
Server-side Tag Manager on Google Cloud load balancer or Cloud Run X-Gclb-Country and X-Gclb-Region Enable region-specific behavior for tags
Server-side Tag Manager on AWS CloudFront CloudFront-Viewer-Country and CloudFront-Viewer-Country-Region Same page
Server-side Tag Manager on Azure Front Door X-Azure-Country Same page
Server-side Tag Manager on Cloudflare CF-IPCountry, via "Add visitor location headers" Same page
Server-side Tag Manager on App Engine Provided automatically Same page

The documentation leaves one question open. The value in the cached object is the location Google resolved for that request. For sites behind the tag gateway, Google's own page says that resolution depends on headers the site's CDN sends. Whether the browser-side cache reflects those headers is neither documented by Google nor tested in the post.

Vallejo's previous post, published on November 5, 2026, shows why location sits so close to consent inside Google's tag. In "Google Consent Mode Internals: Consent Decision Chain and the gcd String", he traced how the tag settles the consent state for each consent type through a chain of layers: update commands, container-scoped defaults, default commands, delegated consent, declared consent and, at the end, implicit consent. When a site defines no consent at all, he wrote, "Google does some assumptions mostly based on the user location."

His example was a visitor from the European Economic Area on a page with plain gtag code and no consent settings. In that case, analytics storage came out as "Implicitly Granted" and ad personalization as "Implicitly Denied". According to the same post, the container's geolocation data holds the country, a region used mostly for Global Privacy Control, and the DMA flag. The declare command, he wrote, is used "when the user is browsing from a DMA region", and only for ad_user_data. On Global Privacy Control, the post says the gcd string marks the signal as on when a visitor's browser sends it from a US state where the tag honors it.

Those consent types have formal definitions. Google Ads Help describes ad_user_data as the setting that "Sets consent for sending user data to Google for advertising purposes" and ad_personalization as the setting that "Sets consent for personalized advertising." The help page applies them to users from the European Economic Area. It does not explain how Google decides which users those are.

Why the data is useful, and where it falls short

Location-based tag rules are routine work in marketing technology: firing a pixel only for visitors from certain countries, applying a stricter consent banner in one jurisdiction, or treating DMA-covered traffic differently. The usual route is a commercial IP geolocation service, queried through an extra request from the page. Vallejo's case for the cached object is that "we can achieve this without paying for a third-party geolocation service or introducing an additional asynchronous request to an external provider." There is a second argument in the post. Reading the cache reproduces how Google itself uses location, so a site's own rules and Google's tags work from the same answer.

Any IP-based location is an estimate, however, and Google's is no exception. The country code in the cache is whatever Google's systems resolved, with the same blind spots as any lookup that relies on IP addresses. The post makes no claims about accuracy.

The surrounding infrastructure has shifted repeatedly. Google's tag gateway for advertisers reached general availability on May 8, 2025, with Cloudflare as launch partner and early adopters reporting an 11% uplift in signals. A Google Cloud deployment option entered beta on January 5, 2026 and became generally available on June 1, 2026. In server-side Tag Manager, Google told container owners that tags for Google Ads, Display & Video 360, Search Ads 360 and Campaign Manager 360 will receive full visitor IP addresses from January 11, 2027, while Google Analytics tags keep redacting them. Location sits underneath each of those changes, and Google's documentation now carries detailed header tables for it.

The container code itself changes too. A Tag Manager release note dated October 8, 2026, changed how gtm.js snippets wait for gtag('config') calls, with the side effect that tags on wildcard custom event triggers may fire an extra time. That change was documented. The object Vallejo describes is not, so a rename or a restructuring of google_tag_data would arrive without a release note, and every variable reading key '0', '1' or '6' would start returning undefined.

Vallejo has appeared in PPC Land coverage before. He is the founder of Analytics Debugger and builds debugging tools for Google's tag ecosystem, and in March 2025 he released an open-source client-side library for capturing ad click identifiers such as gclid, fbclid and msclkid.

What the post does not say

The post shows eight keys in its decoded example but explains only three, leaving keys 2, 3, 4, 5 and 9 unlabelled. It gives no accuracy figures and does not discuss VPNs or proxies. It does not say which tags carry the string, whether gtag.js, gtm.js or both, or how early on a page the object exists. It also does not address whether using a visitor's location to decide which pixels fire raises consent questions of its own. Google has published nothing on the object.

Key facts

  • Source: "Leveraging Google Tag's Built-in Geolocation Data", by David Vallejo, Thyngster, published November 10, 2026 (page metadata shows a modification the same day)
  • Object path: window.google_tag_data.xcd.ip_geo_data_cache.get()
  • Variables: get_country (key '0', ISO 3166-1 country code), get_region (key '1', region code such as ES-MC), is_dma_region (key '6', true or false)
  • Encoding in the container: base64 string, decodable with atob(), according to the post; shown as entry 22 in a list of values in the container code
  • Decoded example in the post: {"0":"ES","1":"ES-MC","2":false,"3":"google.es","4":"region1","5":false,"6":true,"9":true}
  • String in the container screenshot, decoded by PPC Land: {"0":"FR","1":"FR-HDF","2":false,"3":"google.fr","4":"region1","5":false,"6":true,"9":true}
  • Earliest date cited: June 13, 2022, per Vallejo, originally to support Regional Data Collection (region1 endpoints)
  • Status: undocumented internal implementation detail, per Vallejo; not accessible from Tag Manager custom templates
  • Related post: "Google Consent Mode Internals: Consent Decision Chain and the gcd String", Thyngster, published November 5, 2026, updated November 8, 2026
  • Google documentation checked: "Set up consent mode on websites" (region parameter, ISO 3166-2); "Enable region-specific behavior for tags" (server-side Tag Manager, updated July 30, 2026); "How Google tag gateway for advertisers sets location"; "EU, Switzerland, or UK-focused data and privacy" (Analytics Help); "Regional data collection" (Analytics Help); "Updates to consent mode for traffic in European Economic Area (EEA)" (Google Ads Help)

Timeline

Summary

Who: David Vallejo, an analytics developer and founder of Analytics Debugger, writing on his Thyngster blog; the subject is Google's tag and Tag Manager containers, and the people affected are advertisers, analysts and developers who run location-dependent tag logic.

What: A post showing that Google tag containers carry an encoded record of the visitor's country, region and Digital Markets Act status, exposed in the browser through window.google_tag_data.xcd.ip_geo_data_cache.get(), with three custom JavaScript variables (get_country, get_region, is_dma_region) that read it. The object is undocumented and may change without notice.

When: The post was published on November 10, 2026. Vallejo dates Google's geolocation on its tagging infrastructure to at least June 13, 2022.

Where: In the browser, on any page where a Google tag loads; the data reflects Google's own location lookup, which Google's documentation ties to regional data collection, region-specific consent defaults, server-side Tag Manager and tag gateway setups.

Why: Location decides how Google routes data and which consent and privacy rules its tags apply. Reading Google's cached answer lets a site apply location rules without a paid geolocation service and from the same location Google's tags use, at the cost of relying on code Google has never documented.