File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 1+ // client module for callbacks on route change
2+ // see https://docusaurus.io/docs/advanced/client#client-module-lifecycles
3+ export function onRouteDidUpdate ( { location, previousLocation } ) {
4+ // Don't execute if we are still on the same page; the lifecycle may be fired
5+ // because the hash changes (e.g. when navigating between headings)
6+ if ( location . pathname !== previousLocation ?. pathname ) {
7+ // hubspot tracking page view
8+ // eslint-disable-next-line no-underscore-dangle, no-multi-assign
9+ const _hsq = window . _hsq = window . _hsq || [ ] ;
10+ _hsq . push ( [ 'setPath' , window . location . pathname ] ) ;
11+ _hsq . push ( [ 'trackPageView' ] ) ;
12+ }
13+ }
Original file line number Diff line number Diff line change @@ -210,4 +210,5 @@ module.exports = {
210210 '^/legal/*' ,
211211 ] ,
212212 } ,
213+ clientModules : [ './clientModule.js' ] ,
213214} ;
You can’t perform that action at this time.
0 commit comments