Created
March 18, 2023 12:25
-
-
Save giovannicocco/b941852e0f6f2cf141f9191938b289e1 to your computer and use it in GitHub Desktop.
Google Tag Manager - Chamando webhook
This file contains 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 headers = new Headers(); | |
headers.append("Content-Type", "application/json"); | |
var body = { | |
"name": {{dlv- Name}}, // Variável da camada de dados | |
"email": {{dlv - Email}}, // Variável da camada de dados | |
"utm_url": {{First Cookie __gtm_campaign_url}}, // Variável de cookie primário | |
"user_agent": navigator.userAgent, | |
"ip": {{dlv - IP Adress}}, // Variável da camada de dados | |
"url": window.location.origin + window.location.pathname, | |
"fbp": {{First Cookie _fbp}} // Variável de cookie primário | |
}; | |
var options = { | |
method: "POST", | |
headers: headers, | |
mode: "cors", | |
body: JSON.stringify(body) | |
}; | |
fetch("https://endpoint-webhook.aqui", options); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment