add stats and change heap (#108)

* add stats and change heap

* improve analytics

* revert main changes

* add repo
This commit is contained in:
Itiel shwartz
2022-11-24 12:35:45 +02:00
committed by GitHub
parent f7d4dcbff4
commit 0b06036a39
6 changed files with 23 additions and 11 deletions

View File

@@ -3,9 +3,9 @@ xhr.onload = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
const status = JSON.parse(xhr.responseText);
const version = status.CurVer
if (status.Analytics && version !== "dev") {
if (status.Analytics) {
enableDD(version)
enableHeap()
enableHeap(version)
}
}
}
@@ -42,7 +42,7 @@ function enableDD(version) {
})
}
function enableHeap() {
function enableHeap(version) {
window.heap = window.heap || [], heap.load = function (e, t) {
window.heap.appid = e, window.heap.config = t = t || {};
let r = document.createElement("script");
@@ -55,5 +55,12 @@ function enableHeap() {
}
}, p = ["addEventProperties", "addUserProperties", "clearEventProperties", "identify", "resetIdentity", "removeEventProperty", "setEventProperties", "track", "unsetEventProperty"], o = 0; o < p.length; o++) heap[p[o]] = n(p[o])
};
heap.load("3615793373");
heap.load("4249623943");
window.heap.addEventProperties({'version': version});
}
function sendStats(name, prop){
if (window.heap) {
window.heap.track(name, prop);
}
}