Track Your New Customers with Cookies

Wed, 10 Mar 2010 22:57:23 -0800

It's possible using any number of website analytics tools such as Google Analytics, Mint, or just the tools that may be provided by your Internet host, to get a sense of how people who visit your website found out about it. It's a great way to see what your major referrers are.

I've been a bit more interested in how people who actually end up becoming customers originally came to our website. This one is a bit tricker, because it means tracking visitors all the way from their first visit through their purchase, but it is more revealing.

How can you do something like this for yourself? Well, it depends a lot on how your store works, but I'll outline the basics.

First off, you need to set a cookie when they arrive at any page of our website and the cookie has not yet been set. Just save the value of the HTTP referer [sic] header. If the value is empty (such as when somebody types in the URL, or clicks on a link to your website from an email message), I find that it's better to set a placholder like "direct" so I know for certain that we didn't have a known referrer. If the cookie is already set, don't replace it; they may come back to your website more than once, but it's (probably) the first referrer that you are interested in knowing about.