views:

66

answers:

3

As a part of the signup process for my online application, I'm thinking of tracking the source and/or search keywords used to get to my site. This would allow me to see what advertising is working and from where with a somewhat finer grain than Google Analytics would.

I assume I could set some kind of cookie with this information when people get to my site, but I'm not sure how I would go about getting it. Is it even possible?

I'm using Rails, but a language-independent solution (or even just pointers to where to find this information) would be appreciated!

Thanks!

+1  A: 

Your best bet IMO would be to use javascript to look for a cookie named "origReferrer" or something like that and if that cookie doesn't exist you should create one (with an expiry of ~24hours) and fill it with the current referrer.

That way you'll have preserved the original referrer all the way from your users first visit and when your users have completed whatever steps you want them to have completed (ie, account creation) you can read back that cookie on the server and do whatever parsing/analyzing you want.

Andy Brice explains the technique in his blog post Cookie tracking for profit and pleasure.

Markus Olsson
A: 

Http Referrer

Nick
A: 

http://locomotivation.com/2008/07/17/smells-like-a-google-search-easily-grab-inbound-search-terms-in-rails-using-search_sniffer

this post tells of a plugin called search_sniffer that's available as:

script/plugin install git://github.com/squeejee/search_sniffer.git

it does just what you want so check it out

derickatunc