12

Last thursday I implemented a change to our GA script - I added the Enhanced Link Attribution and added the setDomainName attribute. Since then, most of our stats are fine, but the Average Visit Duration has gone completely insane.

We went from averaging around 4mins/visit to massive spikes every morning after midnight of visit times exceeding two hours. I figure it must be something I did wrong, as it started going out of control about the same hour that I deployed the change.

I don't want to flail about making changes on production until I can figure out the cause - any help or suggestions would be greatly appreciated.

Hourly analytics for Average Visit Duration:

Visit duration starts as averaging 3min, after Thursday it starts spiking each morning just after midnight around 2 and a half hours/visit, and dropping down to about 4min/visit by the end of the day.

The current GA script

var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';

_gaq.push(['_require', 'inpage_linkid', pluginUrl]);
_gaq.push(['_setCustomVar', 1, 'Locale', 'en_CA', 2]);
_gaq.push(['_setAccount', 'REDACTED']);
_gaq.push(['_setSiteSpeedSampleRate', 10 ]);
_gaq.push(['_setDomainName', 'REDACTED']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
4
  • Did you set the _setSiteSpeedSampleRate at the same time ? Apr 24, 2013 at 22:38
  • At first sight this seems like a request loop to me? A robot visits the site, follows a link chain that eventually points back to the original location (somehow unnoticed by the bot). The spikes tend to lower with time as locations that get cached won't be fetched from the server anymore. This is just a first guess after a quick look though...
    – Powerslave
    Apr 25, 2013 at 11:28
  • @GabyakaG.Petrioli That was set previously, I think.
    – Jay
    Apr 26, 2013 at 20:58
  • I have no idea what this is, but it may help quite a bit to get a little more information if you have not already. Perhaps try creating an advanced segment that isolates all the people spending more than X amount of time on the site. Then zoom into that segment and look at things like the operating system, the hostname, and the location the traffic is coming from that's causing these weird spikes. Perhaps all the traffic that lasts longer than 10 minutes after midnight comes from the same city, and it's a search engine, or scrapers crawling the site for content. Seems weird that it's at the sa Apr 27, 2013 at 20:43

3 Answers 3

4

EDIT I solved it. See details below - but summary is that its a symptom of auto-refresh javascript causing sessions that span multiple days. GA resets all session at midnight so it appears as if many long session start at midnight, but they don't, they may start at any hour of the day.


Did you ever figure out what the cause was? We are seeing the same thing, huge spikes in average session length - just started recently. Also at midnight.

We tried what @newUserNameHere suggested - we created an advanced segment for these long sessions (sometimes spanning up to 10 hours, but averaging 1.5 hours) - and we saw that it is made up of about 700 unique users - spanning all browser versions, including multiple dot patch versions of chrome, and spanning the entire world and the entire US. So it doesn't seem like its a single bot...or at least if it is - it is a very distributed and varied bot(s)? Chart1 chart2

Edit

I solved it!

I turned out the developers have implemented an "automatic" refresh on our site, every 15 minutes. This essentially caused Google Analytics to see any user who kept their browser open as an endlessly long session (as long you hit the site within 30 minutes, it extends the session). Since Google Analytics resets all sessions at midnight, and since the graph above displays sessions based on when they STARTED - we are seeing many many very long sessions starting at midnight. Where in reality, the long sessions just continue all day long, and can start whenever.

This was actually requested by our Product team, but I had no idea.

After drilling down into the data in Google Analytics, I just theorized that something like that must be going on, contiously pinging the site (or at least Google Analytics) to keep the sessions live before 30 minutes are up.

I left a browser open with Charles HTTP Debugger open as well, for a few hours to see what was going on, and I discovered this behavior.

When I brought this back to the developers and to the Product team, they said "of course, we just asked for and implemented this behavior 2 weeks ago."

(Actually seems strangely, gratifyingly scientific. I saw some wierd symptoms. I had a theory as to what could cause it. I set up an experiment to test it (Browser+Charles open), and the experiment proved my theory.)

If you are still seeing this problem, I would suggest trying the above method (leave a browser open for a few hours, along with Charles HTTP debugger). If you don't see the page being refreshed regularly, perhaps its not the homepage - you should use an advanced segment to determine which page this is happening on, and try this on that page.

1
  • Sadly, no I never did get a solution on this, sorry. Please let me know if you solve it.
    – Jay
    Oct 22, 2013 at 15:04
3
+25

Just a guess but this could be a time zone related bug.

Try to change the time zone for your GA account and see if that changes the report.

1
  • Its not. Its auto-refresh - causing multi-day-long sessions. GA resets all sessions at midnight so it appears as if many new long ones start at midnight. In reality this its just a symptom of auto-refresh javascript causing sessions that span multiple days. See my answer for specifics.
    – Gal
    Nov 30, 2013 at 7:00
1

It's possible that this is related to how Google tracks sessions. A session is automatically ended at the end of the day, so if someone's been actively interacting with your site prior to midnight, they will be a new visit at midnight, in addition to the actual new visits that come in during that hour.

How Visits are calculated in Analytics

Another possibility is that its caused by duplicated versions of the __utma and __utmz cookies on users's machine. Changes from the sync to the async GATC can cause it. To solve you may need to delete the extra cookies somehow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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