<script> | |
(function () { | |
var url = "https://script.google.com/macros/s/AKfycbyqqd-NuGVuYVz0MK9KNoLgP5V7Ny9sdde0y4M1tBWYr6jWDb7rxI7g/exec" //replace with your AppsScript URL | |
var hash = "{{url - acid}}" //replace with your Variable name in two curly brackets { | |
function httpGetAsync(requestURL, callback) | |
{ | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.onreadystatechange = function() { | |
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) | |
callback(xmlHttp.responseText); | |
} | |
xmlHttp.open("GET", requestURL, true); // true for asynchronous | |
xmlHttp.send(null); | |
} | |
try{ | |
httpGetAsync(url+"?acid="+hash, function(data){ | |
var userData = JSON.parse(data); | |
userData["event"] = "acUser"; | |
dataLayer.push(userData); | |
}); | |
} | |
catch(e) { | |
return e; | |
}; | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment