Skip to content

Instantly share code, notes, and snippets.

@kmclaugh
Created January 4, 2024 16:30
Show Gist options
  • Save kmclaugh/d1984d4799be6bfe0120997fe7f73e6f to your computer and use it in GitHub Desktop.
Save kmclaugh/d1984d4799be6bfe0120997fe7f73e6f to your computer and use it in GitHub Desktop.
GTM Recipe for Calendly Conversion Tracking with Segment
{
"exportFormatVersion": 2,
"exportTime": "2024-01-04 16:27:54",
"containerVersion": {
"path": "accounts/6004616452/containers/116024490/versions/0",
"accountId": "6004616452",
"containerId": "116024490",
"containerVersionId": "0",
"container": {
"path": "accounts/6004616452/containers/116024490",
"accountId": "6004616452",
"containerId": "116024490",
"name": "Test",
"publicId": "GTM-ND2HCQL",
"usageContext": ["WEB"],
"fingerprint": "1682959389487",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/6004616452/containers/116024490/workspaces?apiLink=container",
"features": {
"supportUserPermissions": true,
"supportEnvironments": true,
"supportWorkspaces": true,
"supportGtagConfigs": false,
"supportBuiltInVariables": true,
"supportClients": false,
"supportFolders": true,
"supportTags": true,
"supportTemplates": true,
"supportTriggers": true,
"supportVariables": true,
"supportVersions": true,
"supportZones": true,
"supportTransformations": false
},
"tagIds": ["GTM-ND2HCQL"]
},
"tag": [
{
"accountId": "6004616452",
"containerId": "116024490",
"tagId": "15",
"name": "Segment - Calendly Scheduled",
"type": "cvt_116024490_9",
"parameter": [
{
"type": "TEMPLATE",
"key": "call",
"value": "track"
},
{
"type": "BOOLEAN",
"key": "useObjectAction",
"value": "true"
},
{
"type": "LIST",
"key": "customProperties",
"list": [
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "email"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Invitee Email}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "full_name"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Invitee Full Name}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "calendly_invitee_uuid"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Invitee Uuid}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "event_type"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Event Type Name}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "calendly_event_type_uuid"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Event Type Uuid}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "event_start_time"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Event Start Time}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "event_end_time"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Event End Time}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "agent_name"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Assigned To}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "calendly_answer_1"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Answer 1}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "schedule_link"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{Referrer}}"
}
]
}
]
},
{
"type": "TEMPLATE",
"key": "defaultProperties",
"value": "{{Default Properties}}"
},
{
"type": "TEMPLATE",
"key": "action",
"value": "Scheduled"
},
{
"type": "TEMPLATE",
"key": "object",
"value": "Calendly"
}
],
"fingerprint": "1704385661701",
"firingTriggerId": ["8"],
"setupTag": [
{
"tagName": "Segment - Calendly Identify"
}
],
"parentFolderId": "19",
"tagFiringOption": "ONCE_PER_EVENT",
"monitoringMetadata": {
"type": "MAP"
},
"consentSettings": {
"consentStatus": "NOT_SET"
}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"tagId": "17",
"name": "Segment - Calendly Identify",
"type": "cvt_116024490_9",
"parameter": [
{
"type": "TEMPLATE",
"key": "call",
"value": "identify"
},
{
"type": "BOOLEAN",
"key": "suppressGa",
"value": "false"
},
{
"type": "LIST",
"key": "customProperties",
"list": [
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "email"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Invitee Email}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key",
"value": "name"
},
{
"type": "TEMPLATE",
"key": "value",
"value": "{{URL - Invitee Full Name}}"
}
]
},
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "key"
},
{
"type": "TEMPLATE",
"key": "value"
}
]
}
]
},
{
"type": "TEMPLATE",
"key": "defaultProperties",
"value": "{{Traits}}"
}
],
"fingerprint": "1704385661702",
"parentFolderId": "19",
"tagFiringOption": "ONCE_PER_EVENT",
"monitoringMetadata": {
"type": "MAP"
},
"consentSettings": {
"consentStatus": "NOT_SET"
}
}
],
"trigger": [
{
"accountId": "6004616452",
"containerId": "116024490",
"triggerId": "8",
"name": "Calendly Scheduled",
"type": "PAGEVIEW",
"filter": [
{
"type": "EQUALS",
"parameter": [
{
"type": "TEMPLATE",
"key": "arg0",
"value": "{{URL - Event Type Uuid}}"
},
{
"type": "TEMPLATE",
"key": "arg1",
"value": "undefined"
},
{
"type": "BOOLEAN",
"key": "negate",
"value": "true"
}
]
}
],
"fingerprint": "1704385661703",
"parentFolderId": "19"
}
],
"variable": [
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "4",
"name": "URL - Invitee Full Name",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "invitee_full_name"
}
],
"fingerprint": "1704385661703",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "5",
"name": "URL - Event End Time",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "event_end_time"
}
],
"fingerprint": "1704385661704",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "6",
"name": "URL - Answer 1",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "answer_1"
}
],
"fingerprint": "1704385661704",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "7",
"name": "URL - Event Type Uuid",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "event_type_uuid"
}
],
"fingerprint": "1704385661705",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "10",
"name": "URL - Invitee Email",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "invitee_email"
}
],
"fingerprint": "1704385661705",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "11",
"name": "URL - Event Start Time",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "event_start_time"
}
],
"fingerprint": "1704385661706",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "12",
"name": "URL - Assigned To",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "assigned_to"
}
],
"fingerprint": "1704385661707",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "13",
"name": "URL - Invitee Uuid",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "invitee_uuid"
}
],
"fingerprint": "1704385661706",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "14",
"name": "URL - Event Type Name",
"type": "u",
"parameter": [
{
"type": "TEMPLATE",
"key": "component",
"value": "QUERY"
},
{
"type": "TEMPLATE",
"key": "queryKey",
"value": "event_type_name"
}
],
"fingerprint": "1704385661707",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "16",
"name": "Traits",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function(){\n return {}\n}"
}
],
"fingerprint": "1704385661708",
"parentFolderId": "19",
"formatValue": {}
},
{
"accountId": "6004616452",
"containerId": "116024490",
"variableId": "18",
"name": "Default Properties",
"type": "jsm",
"parameter": [
{
"type": "TEMPLATE",
"key": "javascript",
"value": "function(){\n return {}\n}"
}
],
"fingerprint": "1704385661708",
"parentFolderId": "19",
"formatValue": {}
}
],
"folder": [
{
"accountId": "6004616452",
"containerId": "116024490",
"folderId": "19",
"name": "Calendly",
"fingerprint": "1704385661178"
}
],
"builtInVariable": [
{
"accountId": "6004616452",
"containerId": "116024490",
"type": "PAGE_URL",
"name": "Page URL"
},
{
"accountId": "6004616452",
"containerId": "116024490",
"type": "PAGE_HOSTNAME",
"name": "Page Hostname"
},
{
"accountId": "6004616452",
"containerId": "116024490",
"type": "PAGE_PATH",
"name": "Page Path"
},
{
"accountId": "6004616452",
"containerId": "116024490",
"type": "REFERRER",
"name": "Referrer"
},
{
"accountId": "6004616452",
"containerId": "116024490",
"type": "EVENT",
"name": "Event"
}
],
"fingerprint": "1704385674694",
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/6004616452/containers/116024490/versions/0?apiLink=version",
"customTemplate": [
{
"accountId": "6004616452",
"containerId": "116024490",
"templateId": "9",
"name": "Segment",
"fingerprint": "1704385373968",
"templateData": "___INFO___\n\n{\n \"type\": \"TAG\",\n \"id\": \"cvt_temp_public_id\",\n \"version\": 1,\n \"securityGroups\": [],\n \"displayName\": \"Segment\",\n \"brand\": {\n \"id\": \"brand_dummy\",\n \"displayName\": \"\",\n \"thumbnail\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAnCAYAAACMo1E1AAAKy2lDQ1BJQ0MgUHJvZmlsZQAASImVlgdUk1kWx9/3pTdaAAEpoTdBOgGkhB5A6VVUQhJIKCEkhGZDZXAEx4KKCKgjOCii4OgIyFgoKhZEsIF1QAYFZR0sYEFlP2AJM7Nnd8/+z3nn/nJz3333vuSdcwGg0FlCYQosB0CqIEMU4uNOi4qOoeGGAA6oAzygATKLLRYygoICAKI5+1dN3AfQtL1jNp3r37//r1LgcMVsAKBYhOM5YnYqwi3IeswWijIAQFUgft2sDOE0I36gKEIKRPjuNCfO8vA0x8/yl5mYsBAPANBIV3gyiyVKBICsjvhpmexEJA95CcIWAg5fgPB0vS5sHouD8HGEF6Wmpk1zH8JGSLwQAMp0nfT4P+VM/Ev+eGl+FitRyrN9zQjvyRcLU1g5/+fV/G+lpkjmzjBAFpkn8g1BLBq5v77kNH8pC+KXBc4xnzMTP8M8iW/4HLPFHjFzzGF5+kv3piwLmOMEvjdTmieDGTbHXLFX6ByL0kKkZyWIPBhzzBLNnytJDpf6eVymNH8uLyxyjjP5EcvmWJwc6j8f4yH1iyQh0vq5Ah/3+XO9pb2niv/UL58p3ZvBC/OV9s6ar58rYMznFEdJa+NwPb3mY8Kl8cIMd+lZwpQgaTw3xUfqF2eGSvdmIH/O+b1B0jtMYvkFzTGIAZYZ3OyM6cI90oQ5In4iL4PGQF4Xl8YUsM0X0awsrCwBmH6rsz//u76ZNwgp4+d9c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RZMxqd0zg1OJkH7XjIUZV+6Qy3YPTq5yy9jp3mAp3sLEoIk9l6rSIMjIypSxsudCByzGfVv5ZqWDis1dRXpCDRy1ahuMhGtkfbc7f2nmS1XxnvzJuKApIEn0p7jKavOEXlgIe3FnBTVTSVwRDLfaDklbBROxgOJPAy0dwvtSIeVWSBgfU9v6Z9XY0fgQGg3+2U7WgnqeSScIq+RMcfgzLWpsPK7tJAneWSA1k9gzx1BDpfG+wWTi5Ee/V7BvnmjUvtKL2ax5hUNrxH1JoZLF5ow9uA9/p/0+1Uht+Z+QaEcjPYYujxQbE4JHFNmIxVoluBsjjcSne9v2VcxlGY9V8BRSFMYuhfo0SzmJON9ROObkcEcbGjVqXyl/DKDYu+ugGPG3B6VSonbIET2auBEnrGbr3nOzkOi/1XtuR+LmPr4Nv6DlAAAAABJRU5ErkJggg\\u003d\\u003d\"\n },\n \"description\": \"Make Segment api calls from Google Tag Manager.\",\n \"containerContexts\": [\n \"WEB\"\n ]\n}\n\n\n___TEMPLATE_PARAMETERS___\n\n[\n {\n \"type\": \"SELECT\",\n \"name\": \"call\",\n \"displayName\": \"Call\",\n \"macrosInSelect\": false,\n \"selectItems\": [\n {\n \"value\": \"track\",\n \"displayValue\": \"track\"\n },\n {\n \"value\": \"page\",\n \"displayValue\": \"page\"\n },\n {\n \"value\": \"identify\",\n \"displayValue\": \"identify\"\n }\n ],\n \"simpleValueType\": true\n },\n {\n \"type\": \"SELECT\",\n \"name\": \"useObjectAction\",\n \"displayName\": \"Use Object Action\",\n \"macrosInSelect\": false,\n \"selectItems\": [\n {\n \"value\": true,\n \"displayValue\": \"True\"\n },\n {\n \"value\": false,\n \"displayValue\": \"False\"\n }\n ],\n \"simpleValueType\": true,\n \"enablingConditions\": [\n {\n \"paramName\": \"call\",\n \"paramValue\": \"track\",\n \"type\": \"EQUALS\"\n }\n ],\n \"defaultValue\": true\n },\n {\n \"type\": \"SELECT\",\n \"name\": \"userId\",\n \"displayName\": \"User ID\",\n \"macrosInSelect\": true,\n \"selectItems\": [],\n \"simpleValueType\": true,\n \"enablingConditions\": [\n {\n \"paramName\": \"spec\",\n \"paramValue\": \"identify\",\n \"type\": \"EQUALS\"\n }\n ]\n },\n {\n \"type\": \"TEXT\",\n \"name\": \"event\",\n \"displayName\": \"Event\",\n \"simpleValueType\": true,\n \"enablingConditions\": [\n {\n \"paramName\": \"useObjectAction\",\n \"paramValue\": false,\n \"type\": \"EQUALS\"\n }\n ]\n },\n {\n \"type\": \"TEXT\",\n \"name\": \"object\",\n \"displayName\": \"Object\",\n \"simpleValueType\": true,\n \"enablingConditions\": [\n {\n \"paramName\": \"useObjectAction\",\n \"paramValue\": true,\n \"type\": \"EQUALS\"\n }\n ]\n },\n {\n \"type\": \"TEXT\",\n \"name\": \"action\",\n \"displayName\": \"Action\",\n \"simpleValueType\": true,\n \"enablingConditions\": [\n {\n \"paramName\": \"useObjectAction\",\n \"paramValue\": true,\n \"type\": \"EQUALS\"\n }\n ]\n },\n {\n \"type\": \"SELECT\",\n \"name\": \"defaultProperties\",\n \"displayName\": \"Default Properties or Traits\",\n \"macrosInSelect\": true,\n \"selectItems\": [],\n \"simpleValueType\": true,\n \"enablingConditions\": [\n {\n \"paramName\": \"call\",\n \"paramValue\": \"load\",\n \"type\": \"NOT_EQUALS\"\n }\n ]\n },\n {\n \"type\": \"SIMPLE_TABLE\",\n \"name\": \"customProperties\",\n \"displayName\": \"Custom Properties or Traits\",\n \"simpleTableColumns\": [\n {\n \"defaultValue\": \"\",\n \"displayName\": \"Key\",\n \"name\": \"key\",\n \"type\": \"TEXT\"\n },\n {\n \"defaultValue\": \"\",\n \"displayName\": \"Value\",\n \"name\": \"value\",\n \"type\": \"TEXT\"\n }\n ],\n \"enablingConditions\": [\n {\n \"paramName\": \"call\",\n \"paramValue\": \"load\",\n \"type\": \"NOT_EQUALS\"\n }\n ]\n },\n {\n \"type\": \"SELECT\",\n \"name\": \"suppressGa\",\n \"displayName\": \"Suppress Google Analytics\",\n \"macrosInSelect\": true,\n \"selectItems\": [\n {\n \"value\": false,\n \"displayValue\": \"False\"\n },\n {\n \"value\": true,\n \"displayValue\": \"True\"\n }\n ],\n \"simpleValueType\": true,\n \"help\": \"Select true to prevent the identify call from being sent to GA. Set to true if the User ID is an email address\",\n \"enablingConditions\": [\n {\n \"paramName\": \"call\",\n \"paramValue\": \"identify\",\n \"type\": \"EQUALS\"\n }\n ]\n }\n]\n\n\n___SANDBOXED_JS_FOR_WEB_TEMPLATE___\n\n// Enter your template code here.\nconst log = require('logToConsole');\nconst JSON = require('JSON');\nconst callInWindow = require('callInWindow');\nconst copyFromWindow = require('copyFromWindow');\nconst customProperties = data.customProperties;\nconst call = data.call;\nconst properties = {};\nif (customProperties){\n for (var i=0; i<customProperties.length; i++){\n var property = customProperties[i];\n properties[property.key] = property.value;\n }\n}\nconst defaultProperties = data.defaultProperties;\nfor (var attrname in defaultProperties) { properties[attrname] = defaultProperties[attrname]; }\nif (call === \"track\"){\n let event = data.event;\n if (data.useObjectAction){\n event = data.object + \" \" + data.action;\n properties.category = data.object;\n properties.object = data.object;\n properties.action = data.action;\n }\n callInWindow('analytics.track', event, properties);\n}\nif (call === \"page\"){\n callInWindow('analytics.page', properties);\n}\nif (call === \"identify\"){\n const userId = data.userId;\n let suppressGa;\n if (data.suppressGa == \"true\" || data.suppressGa == true){\n suppressGa = true;\n }\n else{\n suppressGa = false;\n }\n const options = {\n integrations: {\n All: true,\n \"Google Analytics\": suppressGa == false\n }\n };\n callInWindow('analytics.identify', userId, properties, options);\n}\n\n\ndata.gtmOnSuccess();\n\n\n___WEB_PERMISSIONS___\n\n[\n {\n \"instance\": {\n \"key\": {\n \"publicId\": \"logging\",\n \"versionId\": \"1\"\n },\n \"param\": [\n {\n \"key\": \"environments\",\n \"value\": {\n \"type\": 1,\n \"string\": \"debug\"\n }\n }\n ]\n },\n \"clientAnnotations\": {\n \"isEditedByUser\": true\n },\n \"isRequired\": true\n },\n {\n \"instance\": {\n \"key\": {\n \"publicId\": \"access_globals\",\n \"versionId\": \"1\"\n },\n \"param\": [\n {\n \"key\": \"keys\",\n \"value\": {\n \"type\": 2,\n \"listItem\": [\n {\n \"type\": 3,\n \"mapKey\": [\n {\n \"type\": 1,\n \"string\": \"key\"\n },\n {\n \"type\": 1,\n \"string\": \"read\"\n },\n {\n \"type\": 1,\n \"string\": \"write\"\n },\n {\n \"type\": 1,\n \"string\": \"execute\"\n }\n ],\n \"mapValue\": [\n {\n \"type\": 1,\n \"string\": \"analytics.track\"\n },\n {\n \"type\": 8,\n \"boolean\": true\n },\n {\n \"type\": 8,\n \"boolean\": true\n },\n {\n \"type\": 8,\n \"boolean\": true\n }\n ]\n },\n {\n \"type\": 3,\n \"mapKey\": [\n {\n \"type\": 1,\n \"string\": \"key\"\n },\n {\n \"type\": 1,\n \"string\": \"read\"\n },\n {\n \"type\": 1,\n \"string\": \"write\"\n },\n {\n \"type\": 1,\n \"string\": \"execute\"\n }\n ],\n \"mapValue\": [\n {\n \"type\": 1,\n \"string\": \"analytics.page\"\n },\n {\n \"type\": 8,\n \"boolean\": true\n },\n {\n \"type\": 8,\n \"boolean\": true\n },\n {\n \"type\": 8,\n \"boolean\": true\n }\n ]\n },\n {\n \"type\": 3,\n \"mapKey\": [\n {\n \"type\": 1,\n \"string\": \"key\"\n },\n {\n \"type\": 1,\n \"string\": \"read\"\n },\n {\n \"type\": 1,\n \"string\": \"write\"\n },\n {\n \"type\": 1,\n \"string\": \"execute\"\n }\n ],\n \"mapValue\": [\n {\n \"type\": 1,\n \"string\": \"analytics.identify\"\n },\n {\n \"type\": 8,\n \"boolean\": true\n },\n {\n \"type\": 8,\n \"boolean\": true\n },\n {\n \"type\": 8,\n \"boolean\": true\n }\n ]\n }\n ]\n }\n }\n ]\n },\n \"clientAnnotations\": {\n \"isEditedByUser\": true\n },\n \"isRequired\": true\n }\n]\n\n\n___TESTS___\n\nscenarios:\n- name: Untitled test 1\n code: |-\n const mockData = {\n // Mocked field values\n };\n\n // Call runCode to run the template's code.\n runCode(mockData);\n\n // Verify that the tag finished successfully.\n assertApi('gtmOnSuccess').wasCalled();\n\n\n___NOTES___\n\nCreated on 11/5/2021, 9:19:41 AM\n\n\n"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment