I use Google Tag Manager. In documentation Google https://developers.google.com/gtagjs/reference/api?hl=en have client_id field name, but I don't understand what needs to be added to the Google Tag Manager tag value in Fields To Set? Thanks
I use Google Tag Manager. In documentation Google https://developers.google.com/gtagjs/reference/api?hl=en have client_id field name, but I don't understand what needs to be added to the Google Tag Manager tag value in Fields To Set? Thanks
Here is the documentation: https://developers.google.com/gtagjs/reference/api?hl=en#set_examples
Example 1 (Get):
const clientIdPromise = new Promise(resolve => {
gtag('get', 'DC-XXXXXXXX', 'client_id', resolve)
});
clientIdPromise.then((client_id) => {
console.log(client_id);
});
Example 2 (Get):
gtag('get', 'DC-XXXXXXXX', 'client_id', function() {
console.log(client_id);
});
Example 3 (Set) (Please note that I haven't tested this):
gtag('set', 'client_id', 'xxxxx.xxxxx');
client_id is used to identify the web client, usually it's auto-generated and saved in the cookies, but if needed you can disable that and set up your own.
Description of the client_id
https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference?client_type=gtag#client_id
How to disable auto-generation and use your own
https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id#getting_the_client_id_from_the_cookie