This objective of this project is to pass details to Google Analytics the first source referral details for how a customer first came to a particular website. This is important because Analytics usually only records the last source for how a customer arrived at a site and I need to know the first source.
As an aside, Adwords tracking does record the first source, but the cookie only lasts 30 days, which isn't long enough as our customer usually take longer than 30 days to convert. The analytics cookie lasts usually around 2 years, so we can use that to capture the details.
Here is how it would work in a bit more detail;
1. User enters site (let's say via organic search for example)
2. The Google Analytics _utmz cookie is populated with their keyword / source / medium etc data
This links shows how to get values of the Google Analytics _utmz cookie and enter them into a hidden form field:
[url removed, login to view]
Updated version of the code: [url removed, login to view]
So the concept is always:
1. Get latest keyword, campaign, source (eg google / yahoo etc) & medium (cpc / organic) data either from a URL parameter or the GA cookie
The important thing is to make sure it's not overwritable, so that the 1st click lives on throughout all their interactions.