Use update ga script and support spa

This commit is contained in:
Misode
2020-07-14 02:17:31 +02:00
parent 49ae481fc9
commit 99c945150a
3 changed files with 16 additions and 9 deletions

View File

@@ -285,7 +285,11 @@ Promise.all([
}
})
const reload = (target: string) => {
const reload = (target: string, track=true) => {
if (track) {
ga('set', 'page', target)
ga('send', 'pageview');
}
selected = modelFromPath(target) ?? ''
if (target) {
history.pushState(target, 'Change Page', target)
@@ -323,6 +327,6 @@ Promise.all([
}
updateLanguage(LOCALES.language)
}
reload(location.pathname)
reload(location.pathname, false)
document.body.style.visibility = 'initial'
})