Archive for April, 2009
Posted on April 29, 2009 by John Henson
During some troubleshooting this week, I came across something that some of you may find useful or interesting (or maybe not.)
You may already know that the pageTracker._initData() line in the GATC has been deprecated. It can still be used however, and is often in place on many websites.
But when you call pageTracker._initData() on some pages, and Don’t call it on other pages, that is when you have a problem. It seems that the cookies are written slightly differently when initData is present vs when it is absent. This causes GA to lose track of the visitor, and lose track of how they arrived at your site (Source, Medium, etc).
Make sure you are consistent throughout your site, with pageTracker._initData(), and you should be fine. Either use it everywhere, or use it nowhere.
— Update/Addition/Clarification:—
If you include initData you need to make sure it is placed after any instructions that alter the way GA writes cookies, such as _setAllowHash(false) or _setDomainName(‘none’)
Example:
Bad:
var pageTracker = _gat._getTracker(“UA-xxxxxxx-y”);
pageTracker._initData();
pageTracker._setDomainName(“sub.domain.com”);
pageTracker._setAllowHash(false);
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
Okay:
var pageTracker = _gat._getTracker(“UA-xxxxxxx-y”);
pageTracker._setDomainName(“sub.domain.com”);
pageTracker._setAllowHash(false);
pageTracker._setAllowLinker(true);
pageTracker._initData();
pageTracker._trackPageview();
* Thanks to Charles at Epik One for this addition
———————————–
John
View Comments (1 Response) | Categories: Conversion Science, Usability
Posted on April 20, 2009 by Robbin Steif
Our Google Analytics training on May 12, 2009 in DC is packed. We are not accepting any more registrations for individuals who want to do configuration and implementation (techie) since that room will be filled; we can only take new registrations for those who want to learn about marketing/analysis.
However, we still have space for everyone at our NYC Google Analytics training on June 2, 2009. It will be identical to the DC training: one day with a marketing/analysis track and a techie track, $285/person, breakfast and lunch included as well as slides, answers to all your questions and Google goodies.
You can read about the training in either city and start the registration process here.
Robbin
View Comments (No Responses) | Categories: Google Analytics, Industry News
Posted on April 14, 2009 by Jonathan Weber
When I’m looking for insights about a website, I often have a laundry list of ideas of things that might be interesting, but only if they happen to pan out. There are lots of false starts and dead ends.
That’s why it’s nice to have a way to quickly get a rough notion about whether certain kinds of visits are significant. The “Test Segment” button that appears when you’re creating Advanced Segments can help you out here.

You can try different criteria and use the Test Segment button to get the number of visits that match — all without actually creating the segments. Play around with the criteria until you get one that’s interesting, and then you’ll probably want to give the segment a meaningful name and save it. But you can cut down time creating a lot of advanced segments that turn out to be not so useful by playing with the Test Segment feature.
View Comments (2 Responses) | Categories: Google Analytics
Posted on April 7, 2009 by John Henson
This is from a question that I answered on the support forum that involved cross-domain tracking and the use of a _setVar().
The problem was that the session information was being lost. That is, GA was losing track of the visitor and started a new visit for them. This not only would alter the visit data, but in the ‘second’ visit, you would lose all of your referral knowledge and this ‘second’ visit would appear direct. Since this is where the conversion was happening, it was a real problem.
The code being used was:
var pageTracker = _gat._getTracker(“UA-xxxxxxx-y”);
pageTracker._setVar(‘buyer’);
pageTracker._setAllowAnchor(true);
pageTracker._setAllowLinker(true);
pageTracker._setAllowHash(false);
pageTracker._trackPageview();
The problem here is the placement of pageTracker._setVar(‘buyer’);
This is a non-obvious problem that actually comes from _setAllowHash(false);
One of the things that _setAllowHash(false) does is to alter the format that GA uses to write cookies to the visitors computer. There are 2 lines here that write cookies, the _setVar and the _trackPageview. One happens before the _setAllowHash and one after. So what was happening was this:
1. pageTracker object gets set up
2. _setVar writes cookies using “Format A”
3. _setAllowHash changes cookie format to B
4. _trackPageview writes cookies using “Format B”
So what we really have is GA getting confused because of some cookie mismatches, and this is what causes the problem.
The solution is simply to make sure you call any _setVar()’s After _setAllowHash. (Or after pageTracker._setDomainName(‘none’); if you use that line.)
This was the first time I’d seen this problem. It is probably pretty uncommon may not be very useful by itself. But a slightly better understanding of what the JavaScript is doing may help you troubleshoot some other situation. (And, more importantly, Robbin wanted me to write a blog post. . .)
View Comments (6 Responses) | Categories: Conversion Science