1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 17:26:37 -04:00

switch simple analytics proxy to a netlify function

This commit is contained in:
2020-08-08 00:13:07 -04:00
parent d9833c6d30
commit 76b3a55efd
10 changed files with 396 additions and 111 deletions

View File

@ -25,7 +25,7 @@
var addEventListenerFunc = window.addEventListener;
var encodeURIComponentFunc = encodeURIComponent;
var decodeURIComponentFunc = decodeURIComponent;
var stringify = JSON.stringify;
// var stringify = JSON.stringify;
var thousand = 1000;
var undefinedVar = undefined;
var language = "language";
@ -112,7 +112,7 @@
}
image.src =
fullApiUrl +
"/send?" +
"?" +
Object.keys(data)
.filter(function (key) {
return data[key] != undefinedVar;
@ -196,11 +196,11 @@
append.scrolled = Math.max(0, scrolled, position());
/** endif **/
if (push || !(sendBeaconText in nav)) {
sendData(append);
} else {
nav[sendBeaconText](fullApiUrl + "/append", stringify(assign(payload, append)));
}
// if (push || !(sendBeaconText in nav)) {
sendData(append);
// } else {
// nav[sendBeaconText](fullApiUrl + "/append", stringify(assign(payload, append)));
// }
};
addEventListenerFunc("unload", sendOnLeave, false);
@ -384,4 +384,4 @@
} catch (e) {
console.warn(e);
}
})(window, "{{ (urls.Parse .Site.BaseURL).Host }}/api/views");
})(window, "{{ (urls.Parse .Site.BaseURL).Host }}/api/send_view");