mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
chore(demo): update demo analytics code
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user