Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a system on my site that sends an email to a customer with a certain url in it (not a private url, just the info they've requested). The format of this url is just straight on:


When the user clicks on this url, Google Analytics sees this as 'Direct' traffic. However, I also have a lot of 'real' direct traffic, users that just type the url, or use bookmarks, and I need to distinguish these 'mailed' users from the rest.

I was thinking about this:


and then in the frontend (a Drupal 7 site), capture this GET variable ref, and if it is set to mail, then call the Javascript to trigger a Google Analytics Event.

Is this the only way to go about? Or are there other/better ways? Thanks for the input!

share|improve this question
up vote 2 down vote accepted

I think I've found the answer you are looking for on Google's support page for Analytics.


Click on the bottom link that reads Custom Campaigns and I bet that you will find what you are looking for.

share|improve this answer
Thanks, looks very good indeed! Do you have any experience with this? Will Google Analytics indeed automatically pick up these variables? – Borniet Feb 4 '14 at 12:50
From what I've read up on there shouldn't be much issues with migrating. And yes Analytics should pick up these variables. I suggest posting on the mailing list for Analytics. Or try IRC. – P1raten Feb 4 '14 at 13:19
Thank you very much! – Borniet Feb 4 '14 at 13:26

Your Answer


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.