admin管理员组文章数量:1314565
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 pletely 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:
The current GA script
var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics/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/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
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 pletely 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:
The current GA script
var _gaq = _gaq || [];
var pluginUrl = '//www.google-analytics./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./ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Share
Improve this question
edited Apr 24, 2013 at 18:32
Bharath
3,0316 gold badges33 silver badges66 bronze badges
asked Apr 5, 2013 at 18:52
JayJay
9011 gold badge8 silver badges18 bronze badges
4
-
Did you set the
_setSiteSpeedSampleRate
at the same time ? – Gabriele Petrioli Commented 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 Commented Apr 25, 2013 at 11:28
- @GabyakaG.Petrioli That was set previously, I think. – Jay Commented 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 ing from that's causing these weird spikes. Perhaps all the traffic that lasts longer than 10 minutes after midnight es 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 – newUserNameHere Commented Apr 27, 2013 at 20:43
3 Answers
Reset to default 4EDIT 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)?
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.
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.
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 e 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.
本文标签: javascriptAverage Visit Duration spikes at midnightStack Overflow
版权声明:本文标题:javascript - Average Visit Duration spikes at midnight - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741966463a2407575.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论