Cardinal Path’s response to COVID-19 Cardinal Path is sharing all we know to help marketers during COVID-19.  Learn more.

Since Google Analytics released custom variables last October, we’ve been finding all kinds of ways to use this flexible, powerful feature. From accomplishing content groupings to tracking the count of purchases by repeat buyers, custom variables have opened the door to both new data in GA and new abilities to segment our data.

One of our favorite uses for custom variables is storing first-touch traffic source information. As you may know, the default model for conversion attribution in Google Analytics is last-touch. In other words, recorded conversions and transactions are attributed to the last traffic source (with the notable exception of direct traffic, which will not override another traffic source). Therefore, it’s difficult to get an understanding of how other traffic sources contribute to conversions. Custom variables have made it much easier to get as this kind of insight with Google Analytics.

Beware this issue!
 

When deploying custom variables to track the first touch, we’ve uncovered an interesting aspect of Google’s 64-character limit for custom variables. First, some background: to record and store first-touch source information, you need to parse GA’s _utmz cookie and store the relevant information in the _utmv cookie, which is dedicated to custom variables. In doing so, it’s easy to hit the character limit (consider that you’re potentially storing source, medium, campaign, keyword, and ad content information).

Here’s the rub: if you try to store more than 64 characters’ worth of information in the _utmv cookie, Google doesn’t simply cut you off at 64 characters and send as much data back as possible. Google flat-out won’t send your custom variable at all!

To avoid this, here are some tips:

1. Choose a short name for your custom variable’s “key,” like “FT” for first touch. The custom variable uses a “key/value” structure in which the key is basically a category of data; in this use case, your key is just first touch, while the value is something like google/organic/big blue widgets. By choosing a short name for your key, you’ll save as many characters as possible for your actual value.

2. Perform a RegEx (regular expression) search-and-replace on the value of your key/value pair to keep only characters that do not require URL encoding. You’ll save yourself many characters by avoiding the need to URL-encode some characters.

3. Trim the length of the value string to 64 characters minus the length of the key. In other words: Value = 64 – (Key length).

4. Finally, go ahead and call setCustomVar() to store the first-touch data in a custom variable.

Here’s the code you’ll need to parse the _utmz cookie and then accomplish steps 2 through 4!

Finally, a word on why first-touch traffic source information can be so valuable. GA’s default attribution model gives you only one view of how valuable various traffic sources are for you. Getting another view can only help you, especially because GA’s default model tends to undervalue traffic sources that may not be as prone to immediate direct response, but could still be adding value for you. Examples of this kind of traffic commonly include display advertising (e.g. Google content network, other banner campaigns) and social networking. By storing first-touch source information, you give yourself the ability to perform a more holistic assessment of the value of these kinds of traffic.

Be aware that this does not only apply to storing first touch information in the cookie. You should always make sure that your cookie length is not too long and does not contain any special characters.

If you have questions on first-touch source information or our solution above, feel free to leave them in the comments. To get more analytics tips and tricks, don’t forget to subscribe to our feed and follow us on Twitter!

Your request has been submitted and a rep will reach out to you shortly.

Message Sent

Thank you for registering.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Click here to download access the tool.

Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Thank you for submitting the form.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.

Message Sent

Thank you for your interest.

Message Sent

Thank you for registering.

Thank you for registering.

You should receive a confirmation email from GoToWebinar with your unique webinar login information. If you do not receive this email or have trouble logging in to the event, please email asmaa.mourad@cardinalpath.com.

Thank you for subscribing!

You're now looped into the world's largest GMP resource hub!

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for your submission.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Success! Thank you
for reaching out.