Skip to content

Instantly share code, notes, and snippets.

@giovannicocco
Created March 18, 2023 12:25
Show Gist options
  • Save giovannicocco/b941852e0f6f2cf141f9191938b289e1 to your computer and use it in GitHub Desktop.
Save giovannicocco/b941852e0f6f2cf141f9191938b289e1 to your computer and use it in GitHub Desktop.
Google Tag Manager - Chamando webhook
<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