I am looking for a way to simulate with Google Analytics _gaq.push that the user has left the page (so GA stops counting on Average time on site).
This is some code I use to track AJAX pages in Google Analytics (it counts a page view):
_gaq.push(['_trackPageview', '/ajax/save']);
What I am looking for is something such as:
_gaq.push(['_exitCurrentPage', 'http://example.com/']);
Does anything with that functionality exist?
Thanks in advance,
Xavi
I don’t think that there’s any specific functionality in GA for this but you could just set a cookie called something like
dont_trackthen set it to simulate the page exit. You could then check for the cookie’s existence before calling your normal tracking code and stop execution if it exists.