Created
March 15, 2017 14:07
-
-
Save vlastv/ce99d79a0097e17271f954d555ee383a to your computer and use it in GitHub Desktop.
Duplicate all Google Analytics hits
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> | |
(function (window, variable, task) { | |
window['GoogleAnalyticsObject'] = variable; | |
window[variable] = window[variable] || function () { | |
(window[variable].q = window[variable].q || []).push(arguments); | |
if (arguments[0] === "create") { | |
window[variable]((arguments[2] && arguments[2].name || "t0") + ".require", "duplicator"); | |
} | |
}; | |
window[variable].l = 1 * new Date(); | |
window[variable]("provide", "duplicator", function (tracker, options) { | |
var xhr = new XMLHttpRequest(), | |
handler = tracker.get(task); | |
tracker.set(task, function (model) { | |
handler(model); | |
xhr.open("GET", "/collect?" + model.get("hitPayload"), true); | |
xhr.send(); | |
}) | |
}); | |
})(window, 'ga', 'buildHitTask'); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment