Created
September 17, 2020 15:48
-
-
Save kmclaugh/c3d86c585071b6bc0f8309659acdb3f8 to your computer and use it in GitHub Desktop.
Add Client ID to Form Input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"exportFormatVersion": 2, | |
"exportTime": "2020-09-17 15:47:20", | |
"containerVersion": { | |
"path": "accounts/4701996609/containers/32482051/versions/0", | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"containerVersionId": "0", | |
"container": { | |
"path": "accounts/4701996609/containers/32482051", | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"name": "add-clientid-to-form", | |
"publicId": "GTM-KGBF25L", | |
"usageContext": [ | |
"WEB" | |
], | |
"fingerprint": "1600349163624", | |
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/4701996609/containers/32482051/workspaces?apiLink=container" | |
}, | |
"tag": [ | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"tagId": "8", | |
"name": "Fill Form Client Id", | |
"type": "html", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "html", | |
"value": "<script>\n var clientId = {{GA - ClientId}};\n var clientIdFields = document.querySelectorAll({{Client Id Field CSS Selector}});\n for (i = 0; i < clientIdFields.length; i++) {\n var clientIdField = clientIdFields[i];\n clientIdField.value = clientId;\n }\n</script>" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "supportDocumentWrite", | |
"value": "false" | |
} | |
], | |
"fingerprint": "1600357567657", | |
"firingTriggerId": [ | |
"14" | |
], | |
"parentFolderId": "3", | |
"tagFiringOption": "ONCE_PER_EVENT", | |
"monitoringMetadata": { | |
"type": "MAP" | |
} | |
} | |
], | |
"trigger": [ | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"triggerId": "7", | |
"name": "Form Visibile", | |
"type": "ELEMENT_VISIBILITY", | |
"fingerprint": "1600352955859", | |
"parentFolderId": "3", | |
"parameter": [ | |
{ | |
"type": "BOOLEAN", | |
"key": "useOnScreenDuration", | |
"value": "false" | |
}, | |
{ | |
"type": "BOOLEAN", | |
"key": "useDomChangeListener", | |
"value": "false" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "elementSelector", | |
"value": "form[name=\"New Form\"]" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "firingFrequency", | |
"value": "ONCE_PER_ELEMENT" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "selectorType", | |
"value": "CSS" | |
}, | |
{ | |
"type": "TEMPLATE", | |
"key": "onScreenRatio", | |
"value": "1" | |
} | |
] | |
}, | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"triggerId": "13", | |
"name": "Window Loaded", | |
"type": "WINDOW_LOADED", | |
"fingerprint": "1600352955860", | |
"parentFolderId": "3" | |
}, | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"triggerId": "14", | |
"name": "Form Visible and Window Loaded", | |
"type": "TRIGGER_GROUP", | |
"fingerprint": "1600352955860", | |
"parentFolderId": "3", | |
"parameter": [ | |
{ | |
"type": "LIST", | |
"key": "triggerIds", | |
"list": [ | |
{ | |
"type": "TRIGGER_REFERENCE", | |
"value": "7" | |
}, | |
{ | |
"type": "TRIGGER_REFERENCE", | |
"value": "13" | |
} | |
] | |
} | |
] | |
} | |
], | |
"variable": [ | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"variableId": "4", | |
"name": "GA - Tracker", | |
"type": "jsm", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "javascript", | |
"value": "function(){\n trackers = ga.getAll();\n return trackers[0];\n}" | |
} | |
], | |
"fingerprint": "1600350982639", | |
"parentFolderId": "3", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"variableId": "5", | |
"name": "GA - ClientId", | |
"type": "jsm", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "javascript", | |
"value": "function(){\n gaTracker = {{GA - Tracker}};\n try {\n return gaTracker.get(\"clientId\");\n }\n catch(e){\n return false;\n }\n}" | |
} | |
], | |
"fingerprint": "1600350982639", | |
"parentFolderId": "3", | |
"formatValue": {} | |
}, | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"variableId": "9", | |
"name": "Client Id Field CSS Selector", | |
"type": "c", | |
"parameter": [ | |
{ | |
"type": "TEMPLATE", | |
"key": "value", | |
"value": "input[name=\"client-id\"]" | |
} | |
], | |
"fingerprint": "1600353049714", | |
"parentFolderId": "3", | |
"formatValue": {} | |
} | |
], | |
"folder": [ | |
{ | |
"accountId": "4701996609", | |
"containerId": "32482051", | |
"folderId": "3", | |
"name": "Add Client ID to Form", | |
"fingerprint": "1600352939859" | |
} | |
], | |
"fingerprint": "1600357640807", | |
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/4701996609/containers/32482051/versions/0?apiLink=version" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var clientId = {{GA - ClientId}}; | |
var clientIdFields = document.querySelectorAll({{Client Id Field CSS Selector}}); | |
for (i = 0; i < clientIdFields.length; i++) { | |
var clientIdField = clientIdFields[i]; | |
clientIdField.value = clientId; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment