Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix: use document.title after page load
Browse files Browse the repository at this point in the history
This is the same solution as
facebook/docusaurus#7424.

Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Nov 2, 2022
1 parent 2d5d810 commit eb510df
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions globalClientModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const module: ClientModule = {
onRouteDidUpdate({location, previousLocation}) {
if (ExecutionEnvironment.canUseDOM) {
if (location.pathname != previousLocation?.pathname) {
_paq.push(['setCustomUrl', location.pathname])
_paq.push(['setDocumentTitle', document.title])
_paq.push(['trackPageView'])
console.log(`path = ${location.pathname}`)
console.log(`title = ${document.title}`)
setTimeout(() => {
_paq.push(['setCustomUrl', location.pathname])
_paq.push(['setDocumentTitle', document.title])
_paq.push(['trackPageView'])
})
}
}
}
Expand Down

0 comments on commit eb510df

Please sign in to comment.