Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want track a site's visitor retention using Google Analytics, to see if unregistered users are returning to it, within a time frame of 2+ months from now.

This blog post seems to be on the right track, but I want to track unregistered users, so I don't have a "join date" or similar variable at my disposal.

This other blog post suggests using all 5 GA custom variables, using the first variable slot on the first week, variable 2 on week 2, etc. This method will allow me to track 5 weeks of visitors.

I want to track more than 5 weeks of visitors, so I was thinking on using two custom variables in GA: visitor's first visit date, and visitor's last visit date.

How I can save the first visit date? Because if I save another value in the same slot the old value will be overwritten, and I don't know how reliable is to save that variable conditionally (reading the __utmv cookie to check whether the "first visit date" is set, if it isn't set I save the current date)

share|improve this question

2 Answers 2

up vote 1 down vote accepted

It sounds like you're on the right track. To track basic retention in Google Analytics you just need to store the initial visit date in a custom variable. Next, using the custom variable and possibly some regex, create an advanced segment which filters for a specific date range of these new visitors. For example, all users who visited for the first time 2 months ago. Finally, use the advanced segment in a report which is constrained to a date range such as last month. That should tell you how many of your visitors from 2 months ago came back the next month, which is your monthly retention.

You also asked how reliable it is to set the first visit date in the cookie only if it's not already set. That's what I've always done and the logic works fine. If you're wondering whether you can trust that a visitor didn't delete their cookies after their first visit, well, you can't. I cover retention analysis in Google Analytics and the issue of cookie tracking reliability on my blog if you need more details.

share|improve this answer
    
How do you determine if a user is visiting the site for the first time? Checking the __utma cookie? –  dusan Sep 5 '12 at 16:50
    
There are more advanced options but you may be able to keep the logic simple by only writing a first visit date to the cookie if it hasn't already been set. Or am I misunderstanding? –  Jono Sep 5 '12 at 17:25
    
Great blog! Now I'm saving the first visit date on a cookie (not a GA cookie) if that cookie is not set. If a visitor has that cookie I send the cookie's value to GA as a custom variable. –  dusan Sep 6 '12 at 17:53

You could write a simple PHP/MySQL script to log all unique IP addresses visiting your site, mark the timestamp, and then not add duplicate entries unless the difference between "timestamp" and "now" is greater than some period of time. Or, you create two entries per IP address: the first time they visit, they are the same. Next time they visit, it checks if that IP is already in the database, and if so, updates the second entry. That way, you'll always have a list (could be graphed) of an IP address's first visit date, and last time they visited. Some would obviously be the same time, and easily displayed as "never returned."

I'll update this answer with some sample code when I get home from work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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