Last Updated: 01 Nov 2012
Google Analytics: Old Campaign Data Appearing in New Reports
If you've used Google Analytics for a while, and run a number of different campaigns (adwords, email, or anything you track with the
utm_campaign variable), you may notice that you get really old campaign data showing up in new reports. For example, I'm still getting a few visits from a campaign that I stopped nearly four months ago! I know the campaign isn't running anywhere anymore, so how come new visits with that campaign source are still showing up in my analytics today?
It has to do with the way the
_utmz cookie stores campaign data. Basically, when a visitor comes into your website via a campaign, Google Analytics stores the information on that campaign in the
_utmz cookie. By default, that cookie has an expiration time of six months. Now, if the user comes into the website later via a different campaign, that new campaign is stored in the
_utmz cookie, overwriting the old one. However, if the user comes back via direct navigation, no data in the cookie is changed, but the expiration date on the cookie is updated (reset for another six months) and the visit is attributed to the campaign recorded in the cookie.
If you think about it for a minute, this is what you'd want to have happen. If a user comes to your website via a campaign today, and then comes back tomorrow and buys something, you'd want the source of the sale to be attributed to your campaign, and not
The trick is the six month expiration time. In my case, I had a few users that came in via my original campaign, and then kept coming back every few weeks for months (via direct navigation). Every single time they came back, the
_utmz cookie provided data on that original campaign and the expiration on
_utmz was updated for another six months. Their new visits were recorded as being from that campaign, even though the campaign had been gone for a long time.
// set the timeout to 30 days (2592000 seconds); same as the adwords cookie _gaq.push(['_setCampaignCookieTimeout', 2592000]);
Now your campaign data will expire after a month, so if the user comes back after that they'll be attributed with a source of
NOTE: Technically, this scheme isn't completely infallible, as the expiration on the cookie is reset with each pageview. So if a user came back to your site every 29 days, they could theoretically persist the
_utmz cookie forever. You could set the timeout shorter, but you start running the risk of losing valuable conversion data. Ultimately, it becomes a judgement call.