← GTM templates
Google Tag Manager template

GA4 Client ID & Session Info

Get the GA4 Client ID, Session ID or session number from a GTM variable.

GA4VariablesDebugging

Template technical sheet

Configurable fields
  • Data to return
  • GA4 Measurement ID
  • Session Field

What it does

Variable that reads GA4 identifiers through the native readAnalyticsStorage API. Choose Client ID, Session ID or Session Number; session data requires a Measurement ID. It is useful for attribution debugging and for preparing data for other tags. Reading depends on analytics_storage being available.

Code and configuration

The repository includes the template file. Review its documentation, configuration and permissions before adding it to your Google Tag Manager container.

Credits

Alfonso Rodríguez, Txema Sánchez and Brais Calvo.