Skip to content

Instantly share code, notes, and snippets.

@giovannicocco
Created March 18, 2023 12:58
Show Gist options
  • Save giovannicocco/deed43241c78358c63c280416cc0f9c0 to your computer and use it in GitHub Desktop.
Save giovannicocco/deed43241c78358c63c280416cc0f9c0 to your computer and use it in GitHub Desktop.
Google Tag Manager - Chamando webhook - Instale direto no seu GTM - Importe esse código para o seu GTM - Não se esqueça de alterar caso necessário o nome da variável de camadas de dados conforme o seu dataLayer.
{
"exportFormatVersion": 2,
"exportTime": "2023-03-18 12:51:51",
"containerVersion": {
"path": "accounts/6006751052/containers/104884648/versions/2",
"accountId": "6006751052",
"containerId": "104884648",
"containerVersionId": "2",
"name": "Webhook",
"container": {
"path": "accounts/6006751052/containers/104884648",
"accountId": "6006751052",
"containerId": "104884648",
"name": "Giovanni Cocco - Exemplos",
"publicId": "GTM-NNN5BPG",
"usageContext": [
"WEB"
],
"fingerprint": "1679143012696",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/6006751052/containers/104884648/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
},
"tagIds": [
"GTM-NNN5BPG"
]
},
"tag": [
{
"accountId": "6006751052",
"containerId": "104884648",
"tagId": "29",
"name": "Webhook",
"type": "html",
"parameter": [
{
"type": "TEMPLATE",
"key": "html",
"value": "<script>\n \n var headers = new Headers();\n headers.append(\"Content-Type\", \"application/json\");\n var body = {\n \"name\": {{dlv- Name}}, // Variável da camada de dados\n \"email\": {{dlv - Email}}, // Variável da camada de dados\n \"utm_url\": {{First Cookie __gtm_campaign_url}}, // Variável de cookie primário\n \"user_agent\": navigator.userAgent,\n \"ip\": {{dlv - IP Adress}}, // Variável da camada de dados\n \"url\": window.location.origin + window.location.pathname,\n \"fbp\": {{First Cookie _fbp}} // Variável de cookie primário\n };\n var options = {\n method: \"POST\",\n headers: headers,\n mode: \"cors\",\n body: JSON.stringify(body)\n };\n\nfetch(\"https://endpoint-webhook.aqui\", options);\n\n</script>"
},
{
"type": "BOOLEAN",
"key": "supportDocumentWrite",
"value": "false"
}
],
"fingerprint": "1679143153723",
"firingTriggerId": [
"11"
],
"tagFiringOption": "ONCE_PER_EVENT",
"monitoringMetadata": {
"type": "MAP"
},
"consentSettings": {
"consentStatus": "NOT_SET"
}
}
],
"trigger": [
{
"accountId": "6006751052",
"containerId": "104884648",
"triggerId": "11",
"name": "Lead - Envio de Formulário",
"type": "FORM_SUBMISSION",
"waitForTags": {
"type": "TEMPLATE"
},
"checkValidation": {
"type": "BOOLEAN",
"value": "false"
},
"waitForTagsTimeout": {
"type": "TEMPLATE",
"value": "2000"
},
"uniqueTriggerId": {
"type": "TEMPLATE"
},
"fingerprint": "1679143744286"
}
],
"variable": [
{
"accountId": "6006751052",
"containerId": "104884648",
"variableId": "5",
"name": "First Cookie __gtm_campaign_url",
"type": "k",
"parameter": [
{
"type": "BOOLEAN",
"key": "decodeCookie",
"value": "true"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "__gtm_campaign_url"
}
],
"fingerprint": "1679143075381",
"formatValue": {}
},
{
"accountId": "6006751052",
"containerId": "104884648",
"variableId": "8",
"name": "dlv- Name",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "gtm.element.0.value"
}
],
"fingerprint": "1679143075382",
"formatValue": {
"convertUndefinedToValue": {
"type": "TEMPLATE",
"value": "0"
}
}
},
{
"accountId": "6006751052",
"containerId": "104884648",
"variableId": "9",
"name": "dlv - Email",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "gtm.element.1.value"
}
],
"fingerprint": "1679143075382",
"formatValue": {
"convertUndefinedToValue": {
"type": "TEMPLATE",
"value": "0"
}
}
},
{
"accountId": "6006751052",
"containerId": "104884648",
"variableId": "22",
"name": "dlv - IP Adress",
"type": "v",
"parameter": [
{
"type": "INTEGER",
"key": "dataLayerVersion",
"value": "2"
},
{
"type": "BOOLEAN",
"key": "setDefaultValue",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "geoData.ip"
}
],
"fingerprint": "1679143075385",
"formatValue": {}
},
{
"accountId": "6006751052",
"containerId": "104884648",
"variableId": "23",
"name": "First Cookie _fbp",
"type": "k",
"parameter": [
{
"type": "BOOLEAN",
"key": "decodeCookie",
"value": "false"
},
{
"type": "TEMPLATE",
"key": "name",
"value": "_fbp"
}
],
"fingerprint": "1679143075386",
"formatValue": {}
}
],
"builtInVariable": [
{
"accountId": "6006751052",
"containerId": "104884648",
"type": "PAGE_URL",
"name": "Page URL"
},
{
"accountId": "6006751052",
"containerId": "104884648",
"type": "PAGE_HOSTNAME",
"name": "Page Hostname"
},
{
"accountId": "6006751052",
"containerId": "104884648",
"type": "PAGE_PATH",
"name": "Page Path"
},
{
"accountId": "6006751052",
"containerId": "104884648",
"type": "REFERRER",
"name": "Referrer"
},
{
"accountId": "6006751052",
"containerId": "104884648",
"type": "EVENT",
"name": "Event"
}
],
"fingerprint": "1679143893132",
"tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/6006751052/containers/104884648/versions/2?apiLink=version"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment