Sedang Disiapkan

Update google analytics cookie using javascript

Project Objective

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.


Create some javascript code which will take the details from the Google Anlaytics cookie on a user’s PC regarding the source of the referral and place it in some custom variables in the cookie. When/if the customer then converts and palces an order, the details of their first visit will be recorded into analytics using the value of the customer variables which have been populated.

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

3. We run some javascript that takes the keyword & source values from the UTMZ cookie (that will get overwritten on their next visit) and copies them into custom variables.

3a This javascript must check to see if the custom variables are already populated and, if so, doesn't overwrite them.

Background info

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 above is much the same - ie copy a cookie value into a javascript variable - but then, rather than pushing the javascript variables into hidden form fields, you push them into custom variables instead, in much the same way as the Adwords version does at [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

2. Populate a javascript variable with this data

3. Use the javascript variable to populate the custom variable in Analytics

URL / GA Cookie -> Javascript -> Customer Variable.

The important thing is to make sure it's not overwritable, so that the 1st click lives on throughout all their interactions.

Experience required

To make this project straight forward it ideally needs working knowledge of the Analytics Cookie format (although the format is pretty easy to work out) and good javascript skills

Kemahiran: Javascript

Lihat lagi: source analytics cookie, google analytics customer variable example, www referral code, run javascript, order custom javascript, method crm, interactions, how to get url using javascript, how to get a value in javascript, how to create google blog, how to create a site on google, create website javascript, 1st source, javascript tracking code site came cookie, javascript data format, how to get on google search, how much is google analytics, google palces, google analytics adwords, google adwords how to, does google adwords work, does adwords work, crm skills, update url via javascript, tracking cookie

Tentang Majikan:
( 25 ulasan ) Shepperton, United Kingdom

ID Projek: #1547464

Dianugerahkan kepada:


Dear Sir Please see your personal message for bid details

£80 GBP dalam sehari
(1 Ulasan)

3 pekerja bebas membida secara purata £173 untuk pekerjaan ini


Hi Sir, I'm good at javascript/xml/asp, I can help you.

£188 GBP dalam 5 hari
(2 Ulasan)

Pls check PMB.

£250 GBP dalam sehari
(0 Ulasan)