Skip to content

Instantly share code, notes, and snippets.

@kmclaugh
Created July 15, 2019 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmclaugh/d0bde3063b7d0a08a0349035ad3c1b3f to your computer and use it in GitHub Desktop.
Save kmclaugh/d0bde3063b7d0a08a0349035ad3c1b3f to your computer and use it in GitHub Desktop.
GTM container that adds "-INTERNAL" to the page title
{
"exportFormatVersion": 2,
"exportTime": "2019-07-15 17:47:27",
"containerVersion": {
"path": "accounts/4701996609/containers/11992448/versions/0",
"accountId": "4701996609",
"containerId": "11992448",
"containerVersionId": "0",
"container": {
"path": "accounts/4701996609/containers/11992448",
"accountId": "4701996609",
"containerId": "11992448",
"name": "temp",
"publicId": "GTM-WP4RRDJ",
"usageContext": [
"WEB"
],
"fingerprint": "1563212833943",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/4701996609/containers/11992448/workspaces?apiLink=container"
},
"variable": [
{
"accountId": "4701996609",
"containerId": "11992448",
"variableId": "16",
"name": "Page Title DEBUG",
"type": "cvt_11992448_21",
"notes": "String to Add must match filter in Google Analytics to properly filter.",
"parameter": [
{
"type": "TEMPLATE",
"key": "stringToAdd",
"value": "-INTERNAL"
},
{
"type": "TEMPLATE",
"key": "debugMode",
"value": "{{Debug Mode}}"
}
],
"fingerprint": "1563212806042",
"parentFolderId": "22",
"formatValue": {}
},
{
"accountId": "4701996609",
"containerId": "11992448",
"variableId": "15",
"name": "Page Title DEBUG - JS",
"type": "jsm",
"notes": "Recommend using custom template instead of this.",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function() {\n 'use strict';\n if ({{Debug Mode}}){\n return document.title + \"-INTERNAL\";\n }\n else{\n return document.title;\n }\n}"
}
],
"fingerprint": "1563212806041",
"parentFolderId": "22",
"formatValue": {}
}
],
"folder": [
{
"accountId": "4701996609",
"containerId": "11992448",
"folderId": "22",
"name": "Filter Internal Traffic",
"fingerprint": "1563212804951"
}
],
"builtInVariable": [
{
"accountId": "4701996609",
"containerId": "11992448",
"type": "DEBUG_MODE",
"name": "Debug Mode"
}
],
"fingerprint": "0",
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/4701996609/containers/11992448/versions/0?apiLink=version",
"customTemplate": [
{
"accountId": "4701996609",
"containerId": "11992448",
"templateId": "21",
"name": "Page Title DEBUG Mode",
"fingerprint": "1563212661672",
"templateData": "___INFO___\n{\"displayName\":\"Page Title DEBUG Mode\",\"description\":\"When in DEBUG mode, add the given string to the page title. When not in DEBUG mode, return the regular title. Useful for filtering out internal traffic when in DEBUG mode\",\"securityGroups\":[],\"id\":\"cvt_temp_public_id\",\"type\":\"MACRO\",\"version\":1,\"containerContexts\":[\"WEB\"]}\n\n___TEMPLATE_PARAMETERS___\n[{\"help\":\"Enter the string you want to add to the title\",\"displayName\":\"String to Add\",\"simpleValueType\":true,\"name\":\"stringToAdd\",\"type\":\"TEXT\"},{\"help\":\"Select the variable you use for DEBUG mode\",\"macrosInSelect\":true,\"selectItems\":[],\"displayName\":\"Debug Mode\",\"simpleValueType\":true,\"name\":\"debugMode\",\"type\":\"SELECT\"}]\n\n___NOTES___\nCreated on 7/15/2019, 12:39:40 PM\n\n___PIXIE_FOR_WEB_TEMPLATE___\nvar readTitle = require('readTitle');\nconst stringToAdd = data.stringToAdd;\nconst debugMode = data.debugMode;\n\nif (debugMode){\n\treturn readTitle() + stringToAdd;\n}\nreturn readTitle();\n\n___WEB_PERMISSIONS___\n[{\"isRequired\":true,\"instance\":{\"param\":[],\"key\":{\"versionId\":\"1\",\"publicId\":\"read_title\"}}}]\n\n"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment