Merge pull request #201 from prymitive/tweak-analytics

chore(demo): update demo analytics code
This commit is contained in:
Łukasz Mierzwa
2018-11-01 20:30:55 +00:00
committed by GitHub

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);