app: disable Turbolinks

Fix #5039
This commit is contained in:
Pierre de La Morinerie 2020-05-07 14:31:36 +00:00
parent d287942e6c
commit b5f1d97629
26 changed files with 22 additions and 66 deletions

View file

@ -25,23 +25,4 @@ if (enabled) {
script.async = true;
script.src = jsUrl;
firstScript.parentNode.insertBefore(script, firstScript);
// Send Matomo a new event when navigating to a new page using Turbolinks
// (see https://developer.matomo.org/guides/spa-tracking)
let previousPageUrl = null;
addEventListener('turbolinks:load', (event) => {
if (previousPageUrl) {
window._paq.push(['setReferrerUrl', previousPageUrl]);
window._paq.push(['setCustomUrl', window.location.href]);
window._paq.push(['setDocumentTitle', document.title]);
if (event.data && event.data.timing) {
window._paq.push([
'setGenerationTimeMs',
event.data.timing.visitEnd - event.data.timing.visitStart
]);
}
window._paq.push(['trackPageView']);
}
previousPageUrl = window.location.href;
});
}