Use Google Tag Manager to pass visitor id and account id
Hi there,
I installed Pendo using Google Tag Manager and I'm now trying to pass visitor id and account id which are both available in my data layer in Google Tag Manager. I tried to find documentation that explains how to do it but couldn't find anything.
I created variables for User ID and Account ID and added them to the custom HTML but without success. I tried both with and without single quotes. Am I doing something wrong? I know the variables work because I'm using them for Google Analytics 4.
pendo.initialize({
visitor: {
id: '{{User ID}}'
},
account: {
id: '{{Account ID}}'
}
});
pendo.initialize({
visitor: {
id: {{User ID}}
},
account: {
id: {{Account ID}}
}
});
Comments
I am also trying to figure out how to accomplish this for use with a Salesforce Experience Cloud site. You've probably already done this, but I finally made some progress when I set the variable names in the Pendo install script to the names of the user defined variables that I created in Google Tag Manager, instead of using the names of the variables as they exist in GA4.
For example, in GA4 the variable for a user's id is called user_id, which is what I was adding directly to the Pendo install script as: {{user_id}}
But I had created user defined variables in GTM based on those GA4 variables. The name of the user_id variable was GTM - User Id. When I added that to Pendo install script it finally registered in the Pendo admin: {{GTM - User Id}}
Please sign in to leave a comment.