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

前端 未结 7 2242
鱼传尺愫
鱼传尺愫 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:40

    If you are using the newer analytics.js API, Google's documentation requires the following code to trigger the event:

    ga('send', 'pageview', '/some-page');
    

    If you are using the older ga.js API, David Walsh suggests AJAX websites to use the _gaq.push method:

    _gaq.push(['_trackPageview', '/some-page']);
    
    0 讨论(0)
提交回复
热议问题