Reputation: 31
I have variables being passed as meta data in the head section:
<meta id="ctl00_BDMeta_UserEmail" name="DCSext.UserEmail" />
<meta id="ctl00_BDMeta_Username" name="DCSext.Username" />
<meta id="ctl00_BDMeta_PageTitle" name="DCSext.PageTitle" />
<meta id="ctl00_BDMeta_PageURL" name="DCSext.PageURL" />
How can I pass these variables into Universal Analytics via GTM?
Would I create new JavaScript variables and pass in the value using getelementbyid?
Then in GTM, create a new JavaScript Variable and enter the new variable new when I configure the variable with the global variable name?
Upvotes: 2
Views: 892
Reputation: 8907
You would need to create a "Custom Javascript" variable (not a "Javascript Variable" variable, as you are not supplying it with a globally declared JS variable).
The Custom JS variable would be used to capture the values you need, possibly based on the IDs you provide using getElementById (or jQuery). So something like this, in your Custom JS tag:
function(){
// do pre-checks to see if meta tag exists
return $('meta#ct100_BDMeta_UserEmail').attr("name");
}
Upvotes: 1