Reputation: 85
If a website is developed in a way such that no matter what the user does, the URL never changes and the page is not reloaded, how can we track the time spent on the page? If you wanted to compare the number of sessions and conversion rate per device type of a website to the one of other websites, is it possible?
Upvotes: 1
Views: 187
Reputation: 89
Yes, it is possible. You need to use an event hits. Not pageview hits. For example - every click on buttons of Your site or images or links. All You need is to implement into Your buttons (images, etc.) HTML code on Your site an onclick events. Just read this https://developers.google.com/analytics/devguides/collection/analyticsjs/events?hl=en
Upvotes: 0
Reputation: 1398
This might help you:
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingTiming
There's a code example as you have to do the programming yourself.
var startTime = new Date().getTime();
setTimeout(myCallback, 200);
function myCallback(event) {
var endTime = new Date().getTime();
var timeSpent = endTime - startTime;
_gaq.push(['_trackTiming', 'Test', 'callback_timeout', timeSpent, 'animation']);
}
I'd suggest implementing some sort of active session variable as well. Something like this:
session timeout due to inactivity
As long as you capture all the info about devices with Google Analytics then you should be able to compare and contrast whatever you want to.
If you supply more detail on your programming language knowledge that would be useful.
Upvotes: 1