chore(demo): update demo analytics code

This commit is contained in:
Łukasz Mierzwa
2018-11-01 19:48:16 +00:00
parent 99f005b52b
commit f675c5c624

View File

@@ -21,3 +21,26 @@
ga("create", "UA-128338979-1", "auto");
ga("send", "pageview");
function getSearch() {
return window.location.search;
}
let search = getSearch();
function updateSearch() {
let newSearch = getSearch();
if (newSearch !== search) {
search = newSearch;
ga("set", "page", window.location.pathname + window.location.search);
}
}
setInterval(function() {
updateSearch();
ga("send", {
hitType: "event",
eventCategory: "heartbeat",
eventAction: "ping"
});
}, 15 * 1000);