Last active
March 2, 2018 14:10
-
-
Save hakanilter/f444aedd682cf95dfdfc35101e17bc4a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* PyroCollector : Clickstream Collector Client | |
* (c)2018 DataPyro.com | |
*/ | |
// set your endpoint | |
var endPoint = "https://d1q9rxqnug6ou7.cloudfront.net/public/blank.gif?"; | |
// collector | |
var pyroCollector = { | |
collect: function(obj) { | |
if (typeof(obj) !== undefined) { | |
var json = encodeURI(JSON.stringify(obj)); | |
var img = document.createElement("img"); | |
img.src = endPoint + "_t=" + new Date().getTime() + "&json=" + json; | |
document.body.appendChild(img); | |
} | |
} | |
}; | |
// collect an object | |
if (typeof(dataLayer) !== undefined && dataLayer.length > 0) { | |
var layers = dataLayer.filter(function(o) { return o['sessionId'] !== undefined; }); | |
if (layers.length > 0) { | |
pyroCollector.collect(layers[0]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment