javascript - Google Analytics: How to track pages in a single page application? -
currently in website, used html5's pushstate()
, popstate
in links increase speed. however, doesn't change real url , looks affect , mess google analytics's code. (doesn't show url change) there possible solution this? thanks,
if using newer analytics.js
api, google's documentation requires following code trigger event:
ga('send', 'pageview', '/some-page');
if using older ga.js
api, david walsh suggests ajax websites use _gaq.push
method:
_gaq.push(['_trackpageview', '/some-page']);
Comments
Post a Comment