From daea4892adb2eafb9bd91629014ecfce5a8ca02d Mon Sep 17 00:00:00 2001 From: Cappy Popp <356651+cappypopp@users.noreply.github.com> Date: Wed, 6 Jan 2021 13:21:19 -0500 Subject: [PATCH] moved GA Client ID code to JS custom GTM variable --- LinkedIn - Demo Form Autofill.html | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/LinkedIn - Demo Form Autofill.html b/LinkedIn - Demo Form Autofill.html index 6be4404..496529b 100644 --- a/LinkedIn - Demo Form Autofill.html +++ b/LinkedIn - Demo Form Autofill.html @@ -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);