GTAG GET API – Custom tag template – News Couple

GTAG GET API – Custom tag template

The GTAG GET API The custom tag template is a tag template for the Google Tag Manager Community Forms Gallery.


This tag writes the specified values hypothetical fields (client ID, session ID, and GCLID) as well as any custom fields set with a Google Analytics 4 form in them dataLayer.

asynchronous uses .get() Google site tag API.

See the official documentation for the API summary.


Create a tag using the GTAG GET API form, and choose all the fields you want to type in dataLayer.

Then, And that’s important, you have to set the tag in the tag sequence to launch it after, after (NS cleaning mark) The Google Analytics 4: Configuration A tag (or an event tag if you’re not using a configure tag).

This mark Should It is launched after the Google Analytics 4 tag is fully launched, otherwise the file gtag() The GET API won’t do anything.

tag sequence

When the tag is activated, it launches a number of calls to gtag() GET API – one for each field to be resolved. Once all fields are resolved, a dataLayer.push() With the following contents:

  "event": "gtagApiGet",
    "client_id": "123123123.123123123",
    "session_id": "1608578585",

Then you can create a custom event trigger for gtagApiGet event and data layer variables for individual field values ​​in gtagApiResult Theme.

Custom event trigger

data layer variable client_id

Release Notes

date set of changes
December 21, 2020 Remove console registration.
December 21, 2020 The initial release.

Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button