moved GA Client ID code to JS custom GTM variable

This commit is contained in:
Cappy Popp 2021-01-06 13:21:19 -05:00
parent 0e0ffda70b
commit daea4892ad

View File

@ -4,15 +4,7 @@
iframeHolderDiv = document.createElement('div'), // so we can style location of button
autoFillLocation = document.querySelector("form[id^='mktoForm_']"), // will only find first Marketo form on a page
firstRow = document.querySelector('form .mktoFormRow'),
hiddenLinkedInInputs = document.createDocumentFragment(), // since we're creating multiple nodes, just do the add once
clientID = (function () {
try {
var tracker = ga.getAll()[0];
return tracker.get('clientId'); // GA/GTM will do this same thing in customTask - see GTM customTask variable
} catch (e) {
return 'n/a';
}
})(),
hiddenLinkedInInputs = document.createDocumentFragment(), // since we're creating multiple nodes, just do the add once
hiddenInputCreator = function (tagName, onChangeHandler) {
var newInput = document.createElement('input');
newInput.style.position = 'absolute';
@ -321,7 +313,7 @@
values.Country,
values.Title,
'{{Page Path}}',
'gclid:' + clientID,
'gclid:' + '{{JS - GA Client ID}}',
].join(' | '),
};
console.log(eventData);