Categories: Cardinal Path

Google Tag Manager – New Built in Variables

Overview

Google Tag Manager (GTM) has introduced a powerful enhancement: the ability to retrieve Client ID and Session ID using Built-in Variables easily. For years, marketers and analysts relied on complex workarounds to access these identifiers. This update simplifies the process, making it more accessible for teams without deep technical expertise.

What’s new?

  • Built-in Variables: GTM now includes predefined variables that automatically capture Client ID, Session ID, and Session Number from Google Analytics 4 (GA4) without custom coding.
  • User-Defined Variables: For advanced users, GTM lets you override default cookie names while still parsing the data correctly—ideal for organizations with custom setups or privacy-driven configurations.

This feature is exclusive to those using Google Tag Manager. If you’re not leveraging GTM, these capabilities won’t apply.


Why This Matters

Client ID and Session ID are critical for accurate analytics:

  • Client ID identifies a browser or device, enabling you to track user behavior across multiple visits.  This data point is often matched with other data points that connect anonymous activity to an individual.
  • Session ID groups interactions within a single visit, providing context for user journeys.

Without these identifiers, it’s nearly impossible to connect the dots between sessions and understand long-term engagement.


Common Use Cases

  1. CRM Integration
    Pass Client ID into hidden form fields so it can later be merged with CRM data, creating a unified customer view.
  2. Measurement Protocol
    Collect these IDs for server-side tracking via Google’s Measurement Protocol, ensuring continuity even when client-side monitoring is limited.
  3. Google Analytics Hits
    Historically, these IDs were passed as custom parameters with GA hits. While possible, this is no longer best practice, as this can result in data processing issues due to vast volumes of unique values.

Methods Used Before This Feature

Before GTM introduced built-in variables, analysts had two main options:

  • Using gtag(): Developers extracted Client ID using custom JavaScript and Google’s global site tag.
  • Accessing the _ga Cookie: Reading the cookie directly to parse Client ID—a fragile and error-prone method requiring technical expertise.

User-Defined Variables Explained

While built-in variables cover most scenarios, user-defined variables offer flexibility for advanced setups. If your implementation uses a custom cookie name or unique storage method, you can configure GTM to parse these values correctly. This ensures compatibility with non-standard environments without sacrificing data integrity.


Gotchas / Caveats

This update simplifies implementation, but sequencing still matters:

  • For first-time visitors, if tags fire before the Client ID is generated, the variable may return undefined. Proper GTM configuration and understanding of tag firing order are essential to avoid data gaps.

Legal Considerations

Client ID is considered a unique identifier and may be subject to privacy regulations such as GDPR or CCPA. You may need explicit user consent before collecting or transmitting this data. Always consult your legal team—this blog is not legal advice.


Conclusion

The addition of built-in and user-defined variables in GTM is a game-changer for marketers and analysts. It reduces complexity, improves reliability, and empowers teams to focus on insights rather than technical hurdles.Ready to optimize your data collection? Contact Cardinal Path for expert guidance on implementing these features and ensuring compliance.

Author

  • Bill is a seasoned expert in tag management and analytics implementations, bringing extensive experience across multiple platforms. His expertise spans Adobe Analytics, Adobe Target, Amplitude, Google Analytics, Tealium, Google Tag Manager, and server-side technology.

    As a Director on the Technical Implementation team, Bill plays a key role in optimizing digital tracking strategies, ensuring seamless data collection, and driving business insights through advanced analytics solutions.

    View all posts
Bill Tripple

Bill is a seasoned expert in tag management and analytics implementations, bringing extensive experience across multiple platforms. His expertise spans Adobe Analytics, Adobe Target, Amplitude, Google Analytics, Tealium, Google Tag Manager, and server-side technology. As a Director on the Technical Implementation team, Bill plays a key role in optimizing digital tracking strategies, ensuring seamless data collection, and driving business insights through advanced analytics solutions.

Share
Published by
Bill Tripple

Recent Posts

Introducing Analytics Advisor in Google Analytics: Platform Expertise at Your Fingertips

If you’ve ever stared at a Google Analytics dashboard wondering where to start, or wished…

1 week ago

Unlocking the Full Potential of Amplitude Analytics with the Browser SDK

One of the first decisions a new Amplitude client must make is how to ingest…

1 week ago

Transform with Google: Accelerate with AI

A Recap of the Merkle Cardinal Path & Google NYC Event – Nov 20, 2025…

2 weeks ago

This website uses cookies.