mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-18 00:00:48 -05:00
fix analytics
This commit is contained in:
@@ -1,10 +1,6 @@
|
|||||||
/* jshint browser: true, laxbreak:true, -W080 */
|
/* jshint browser: true, laxbreak:true, -W080 */
|
||||||
|
|
||||||
/*!
|
/*! Simple Analytics - Privacy friendly analytics (docs.simpleanalytics.com/script; 2020-03-02; 21e2) */
|
||||||
* Copyright (c) 2018-2020 Simple Analytics. Licensed under MIT.
|
|
||||||
* https://github.com/simpleanalytics/scripts/blob/master/LICENSE
|
|
||||||
*/
|
|
||||||
|
|
||||||
// https://github.com/simpleanalytics/scripts/blob/3918189e9137b55522a2dbeb3d7cb4bc2c26c52a/src/default.js
|
// https://github.com/simpleanalytics/scripts/blob/3918189e9137b55522a2dbeb3d7cb4bc2c26c52a/src/default.js
|
||||||
|
|
||||||
(function(window, baseUrl, apiUrlPrefix, version, saGlobal) {
|
(function(window, baseUrl, apiUrlPrefix, version, saGlobal) {
|
||||||
@@ -90,7 +86,7 @@
|
|||||||
data = assign(payload, data);
|
data = assign(payload, data);
|
||||||
new Image().src =
|
new Image().src =
|
||||||
fullApiUrl +
|
fullApiUrl +
|
||||||
"/s.gif?" +
|
"/send.gif?" +
|
||||||
Object.keys(data)
|
Object.keys(data)
|
||||||
.filter(function(key) {
|
.filter(function(key) {
|
||||||
return data[key] != undefinedVar;
|
return data[key] != undefinedVar;
|
||||||
@@ -128,11 +124,6 @@
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
/** if spa **/
|
|
||||||
var pushState = "pushState";
|
|
||||||
var dis = window.dispatchEvent;
|
|
||||||
/** endif **/
|
|
||||||
|
|
||||||
/** if duration **/
|
/** if duration **/
|
||||||
var duration = "duration";
|
var duration = "duration";
|
||||||
var start = now();
|
var start = now();
|
||||||
@@ -150,8 +141,8 @@
|
|||||||
|
|
||||||
// Don't track when localhost
|
// Don't track when localhost
|
||||||
/** unless testing **/
|
/** unless testing **/
|
||||||
//if (loc.hostname.indexOf(".") == -1)
|
if (loc.hostname.indexOf(".") == -1)
|
||||||
// return warn(notSending + "from " + loc.localhost);
|
return warn(notSending + "from " + loc.localhost);
|
||||||
/** endunless **/
|
/** endunless **/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -288,11 +279,6 @@
|
|||||||
// Obfuscate personal data in URL by dropping the search and hash
|
// Obfuscate personal data in URL by dropping the search and hash
|
||||||
var path = decodeURIComponentFunc(loc.pathname);
|
var path = decodeURIComponentFunc(loc.pathname);
|
||||||
|
|
||||||
/** if hash **/
|
|
||||||
// Add hash to path when script is put in to hash mode
|
|
||||||
if (mode == "hash" && loc.hash) path += loc.hash.split("?")[0];
|
|
||||||
/** endif **/
|
|
||||||
|
|
||||||
// Don't send the last path again (this could happen when pushState is used to change the path hash or search)
|
// Don't send the last path again (this could happen when pushState is used to change the path hash or search)
|
||||||
if (lastSendPath == path) return;
|
if (lastSendPath == path) return;
|
||||||
|
|
||||||
@@ -336,64 +322,6 @@
|
|||||||
sendPageView(isPushState, isPushState || userNavigated);
|
sendPageView(isPushState, isPushState || userNavigated);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** if spa **/
|
|
||||||
var his = window.history;
|
|
||||||
var hisPushState = his ? his.pushState : undefinedVar;
|
|
||||||
|
|
||||||
// Overwrite history pushState function to
|
|
||||||
// allow listening on the pushState event
|
|
||||||
if (hisPushState && Event && dis) {
|
|
||||||
var stateListener = function(type) {
|
|
||||||
var orig = his[type];
|
|
||||||
return function() {
|
|
||||||
var rv = orig.apply(this, arguments);
|
|
||||||
var event;
|
|
||||||
if (typeof Event == "function") {
|
|
||||||
event = new Event(type);
|
|
||||||
} else {
|
|
||||||
// Fix for IE
|
|
||||||
event = doc.createEvent("Event");
|
|
||||||
event.initEvent(type, true, true);
|
|
||||||
}
|
|
||||||
event.arguments = arguments;
|
|
||||||
dis(event);
|
|
||||||
return rv;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
his.pushState = stateListener(pushState);
|
|
||||||
|
|
||||||
addEventListenerFunc(
|
|
||||||
pushState,
|
|
||||||
function() {
|
|
||||||
pageview(1);
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
addEventListenerFunc(
|
|
||||||
"popstate",
|
|
||||||
function() {
|
|
||||||
pageview(1);
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/** endif **/
|
|
||||||
|
|
||||||
/** if hash **/
|
|
||||||
// When in hash mode, we record a pageview based on the onhashchange function
|
|
||||||
if (mode == "hash" && "onhashchange" in window) {
|
|
||||||
addEventListenerFunc(
|
|
||||||
"hashchange",
|
|
||||||
function() {
|
|
||||||
pageview(1);
|
|
||||||
},
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/** endif **/
|
|
||||||
|
|
||||||
pageview();
|
pageview();
|
||||||
|
|
||||||
/** if events **/
|
/** if events **/
|
||||||
@@ -445,4 +373,4 @@
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
sendError(e);
|
sendError(e);
|
||||||
}
|
}
|
||||||
})(window, "{{ (urls.Parse .Site.BaseURL).Host }}");
|
})(window, "{{ (urls.Parse .Site.BaseURL).Host }}/sa");
|
||||||
|
|||||||
7
assets/vendor/emoji/emoji.js
vendored
7
assets/vendor/emoji/emoji.js
vendored
@@ -1,9 +1,8 @@
|
|||||||
/* jshint indent: 2, browser: true, bitwise: true, plusplus: true */
|
/* jshint indent: 2, browser: true, bitwise: true, plusplus: true */
|
||||||
|
|
||||||
/*!
|
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//*
|
||||||
* Copyright (c) 2018 Twitter, Inc. and other contributors. Licensed under MIT.
|
https://github.com/twitter/twemoji/blob/gh-pages/LICENSE
|
||||||
* https://github.com/twitter/twemoji/blob/gh-pages/LICENSE
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
(function (
|
(function (
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@
|
|||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
{{ if eq hugo.Environment "production" }}
|
{{ if eq hugo.Environment "production" }}
|
||||||
<amp-pixel src="https://s.jarv.is/image.gif" layout="nodisplay"></amp-pixel>
|
<amp-pixel src="{{ "sa/noscript.gif" | absURL }}?hostname=CANONICAL_HOSTNAME&path=CANONICAL_PATH&referrer=DOCUMENT_REFERRER&https=true&ua=USER_AGENT&width=SCREEN_WIDTH&type=pageview" layout="nodisplay"></amp-pixel>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{{ if eq hugo.Environment "production" }}
|
{{ if eq hugo.Environment "production" }}
|
||||||
<link rel="preconnect" href="https://s.jarv.is" crossorigin>
|
|
||||||
{{ if and .IsPage (and (eq .Type .Site.Params.mainSection) (ne .Params.comments false)) }}
|
{{ if and .IsPage (and (eq .Type .Site.Params.mainSection) (ne .Params.comments false)) }}
|
||||||
<link rel="preconnect" href="https://utteranc.es" crossorigin>
|
<link rel="preconnect" href="https://utteranc.es" crossorigin>
|
||||||
<link rel="preconnect" href="https://api.utteranc.es" crossorigin>
|
<link rel="preconnect" href="https://api.utteranc.es" crossorigin>
|
||||||
|
|||||||
17
netlify.toml
17
netlify.toml
@@ -81,10 +81,25 @@
|
|||||||
|
|
||||||
# Proxy data to Simple Analytics endpoint
|
# Proxy data to Simple Analytics endpoint
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/s.gif*"
|
from = "/sa/send.gif*"
|
||||||
to = "https://queue.simpleanalyticscdn.com/simple.gif:splat"
|
to = "https://queue.simpleanalyticscdn.com/simple.gif:splat"
|
||||||
status = 200
|
status = 200
|
||||||
force = true
|
force = true
|
||||||
|
[[redirects]]
|
||||||
|
from = "/sa/noscript.gif*"
|
||||||
|
to = "https://queue.simpleanalyticscdn.com/noscript.gif:splat"
|
||||||
|
status = 200
|
||||||
|
force = true
|
||||||
|
[[redirects]]
|
||||||
|
from = "/sa/append"
|
||||||
|
to = "https://queue.simpleanalyticscdn.com/append"
|
||||||
|
status = 200
|
||||||
|
force = true
|
||||||
|
[[redirects]]
|
||||||
|
from = "/sa/post"
|
||||||
|
to = "https://api.simpleanalytics.io/post"
|
||||||
|
status = 200
|
||||||
|
force = true
|
||||||
|
|
||||||
# Support ancient RSS subscriptions and links from WordPress era:
|
# Support ancient RSS subscriptions and links from WordPress era:
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"start": "hugo server --disableFastRender --buildDrafts --buildFuture --port 1337 --bind 0.0.0.0 --verbose",
|
"start": "hugo server --disableFastRender --buildDrafts --buildFuture --port 1337 --bind 0.0.0.0 --verbose",
|
||||||
"optimize": "run-s optimize:**",
|
"optimize": "run-s optimize:**",
|
||||||
"optimize:html": "html-minifier --html5 --collapse-whitespace --collapse-boolean-attributes --preserve-line-breaks --minify-css --file-ext html --input-dir public --output-dir public **/*.html",
|
"optimize:html": "html-minifier --html5 --collapse-whitespace --collapse-boolean-attributes --preserve-line-breaks --minify-css --file-ext html --input-dir public --output-dir public **/*.html",
|
||||||
"optimize:js": "terser --mangle --compress passes=3,negate_iife=false,keep_fargs=false,sequences=false,reduce_vars=false --mangle-props --output public/js/app.js -- public/js/app.js",
|
"optimize:js": "terser --compress passes=3,negate_iife=false,keep_fargs=false,sequences=false,reduce_vars=false --mangle reserved=['sa'] --output public/js/app.js -- public/js/app.js",
|
||||||
"optimize:img": "find ./public -type d ! -path './public/vendor*' | xargs -n1 -P8 -I{} imagemin {}/* --plugin=jpegoptim --plugin.jpegoptim.progressive --plugin.jpegoptim.stripAll --plugin=pngquant --plugin.pngquant.quality={0.1,0.3} --plugin.pngquant.speed=1 --plugin.pngquant.strip --plugin=gifsicle --plugin=svgo --out-dir={}",
|
"optimize:img": "find ./public -type d ! -path './public/vendor*' | xargs -n1 -P8 -I{} imagemin {}/* --plugin=jpegoptim --plugin.jpegoptim.progressive --plugin.jpegoptim.stripAll --plugin=pngquant --plugin.pngquant.quality={0.1,0.3} --plugin.pngquant.speed=1 --plugin.pngquant.strip --plugin=gifsicle --plugin=svgo --out-dir={}",
|
||||||
"lint": "run-s lint:**",
|
"lint": "run-s lint:**",
|
||||||
"lint:scss": "stylelint assets/sass/**/* --syntax scss",
|
"lint:scss": "stylelint assets/sass/**/* --syntax scss",
|
||||||
|
|||||||
Reference in New Issue
Block a user