Mobile app version of vmapp.org
Login or Join
Goswami781

: Can I use Google Analytics for long-polling my visitors? I'm running an online music compilation archive. Visitors can download and stream the audio. When streaming, visitors are able to keep

@Goswami781

Posted in: #GoogleAnalytics

I'm running an online music compilation archive. Visitors can download and stream the audio. When streaming, visitors are able to keep browsing the site, but sometimes the page is just kept open in a browser tab. Each compilation is between 20 minutes and 3 hours long.

I suspect Google Analytics becomes untrustworthy after a couple of minutes. The 'Real-Time Overview' no longer shows these users as active. Also, duration on the page seems to be updated when they load a new page. But more often than not, the site is exited after listening to compilation, losing the duration information.

What can I do to more accurately track my visitors' behavior? Can I periodically let GA poll the visitor and update their session and page duration?

Update:

I had already increased my session timeout to the maximum allowed length of 4 hours, as can be seen below:

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Goswami781

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini213

You can set a timer and have it trigger a GA event. There are two ways to implement this, depending on how you want to read the data.


Tag Manager timers. Set intervals: 30 seconds, 1 minute, 2 minute, 5 minute, etc. Set up an event report for each and attach it to a trigger that fires after x number of seconds.
Rather than set up timed intervals, you can create a script that'll poll with events.


As a long winded example (requires analytics.js has been loaded):

// This will count the number of times the function runs.
pageTimer = 0;
// Periodically run the function
window.setInterval(function(){
// Increment the counter
pageTimer = pageTimer + 1
// Assumes it runs every 30 seconds
theNow = pageTimer * 30
ga('send', {
hitType: 'event',
eventCategory: 'Timer',
eventAction: theNow + ' seconds on page',
eventLabel: 'Video name?'
});
}, 30000); // Run every 30 seconds


That code should be optimised before use - I've written it the long way to demonstrate it's workings.

10% popularity Vote Up Vote Down


 

@Hamaas447

The real time reports show users who are currently active and doing some activity. The reason why users disappear is because they are inactive for 30 mins and their session times out.

One thing you can do is increase your session duration to 3 hours

here's how you can increase your session duration support.google.com/analytics/answer/2795871?hl=en
and real time reporting support.google.com/analytics/answer/1638635?hl=en
secondly you can use the user id view in GA support.google.com/analytics/answer/3123662?hl=en
Here's how you can setup user id view support.google.com/analytics/answer/3123666?hl=en

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme