Google Analytics: How to track pages in a single page application?

前端 未结 7 2264
鱼传尺愫
鱼传尺愫 2021-01-31 08:44

Currently in my website, I used HTML5\'s pushState() and popState in links to increase the speed. However, this doesn\'t really change the real URL and it

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 09:31

    Recent answer (2017)

    You can now use Google's autotrack.js, a script that enhances analytics.js.

    It includes a plugin that automatically tracks URL changes for single page applications.

    You just need to include the script and the following line in your html:

    ga('require', 'urlChangeTracker');
    

提交回复
热议问题