2

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:

Session settings

1

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 https://support.google.com/analytics/answer/2795871?hl=en

and real time reporting https://support.google.com/analytics/answer/1638635?hl=en

secondly you can use the user id view in GA https://support.google.com/analytics/answer/3123662?hl=en

Here's how you can setup user id view https://support.google.com/analytics/answer/3123666?hl=en

1

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.

  1. 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.

  2. 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.

  • Making custom events sounds like a good way to do this. Could you please elaborate (preferably in-answer) what this will look like in Google Analytics? Judging by your code, events will be grouped by occurrences per 30 seconds. So something like 50 hits on 30 seconds on page, 35 hits on 60 seconds per page, 20 hits on 90 seconds per page, and so on. Mind that my audio is very long so this would results in enormous amounts of different event actions. I think this answer could be improved it the data was eventually aggregated in a more useful way. – Marc Dingena Aug 19 '16 at 12:23
  • It all depends on how you want to aggregate it. Theoretically, you could create an event for when the page unloads that'll tell you how long they sat around for. But how do you want that labelled and presented? I recommend choosing your increments and adjusting around them. – L Martin Aug 19 '16 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.