MoOx / pjax

Easily enable fast Ajax navigation on any website (using pushState + xhr)
MIT License
1.43k stars 124 forks source link

what meaning of analytics options ? #226

Closed jerryc127 closed 3 years ago

jerryc127 commented 4 years ago

what meaning of analytics options ?

it mean we don't need to do anything like reload the google analytics ?

mtimofiiv commented 4 years ago

When you navigate to a new page, since with this module you are not reloading the page, analytics scripts might not be aware that the page has changed to track page views or whatever. It's necessary to tell Google Analytics (or others if you don't use it) that a navigation has happened.

In the Google script, you can send it an event telling GA that the navigation happened using the ga() function. So, you don't need to re-load the GA script, but you need to trigger an event saying the user has navigated to a new page.

You can find docs on that here, on Google's developer site: https://developers.google.com/analytics/devguides/collection/analyticsjs/pages