Tracking Code, Tracking Pixels, Cookies & UTM Parameters

  • What is Tracking Code, Tracking Pixels and Cookies?
  • What are UTM Parameters, fclid and gclid?
  • How to set-up UTM Parameters on Facebook Ads
  • How to set-up UTM Parameters on Google Ads
image of web browsers
Image of co-founder

by Al Taylor
Updated June 10th 2021

Contents

Section 1

Tracking Code, Tracking Pixels and Cookies

Section 2

What are UTM Parameters?

Section 3

Set-up UTM Parameters in Facebook

Section 4

Set-up UTM Parameters in Google Ads

Section 1:

Tracking Code, Tracking Pixels and Cookies

How does a web analytics tool such as Google Analytics Track Visitors to your site?

By using Tracking Code and a Pixel to send the information to the GA server.

How do you see information about visitors to your website?

Most websites use a web analytics tool to view information about visitors to their site. The tool uses a ‘pixel’ or ‘tag’ to send information to the web analytics tool about visitors to you site. Data about visits can then be viewed using the tool.

The most commonly used web analytics tool is Google Analytics, which is free (though there is a paid version that is very expensive).

What is a Tracking Pixel?

A ‘Tracking Pixel’ is a slightly misleading term as the tracking mechanism is actually a snippet of Javacript code. This piece of code is included on each page of your site and collects information from the HTTP request to the server; the user’s browser/system information and first party cookies.

All this information is then sent to the analytics server using a list of parameters attached to a single-pixel GIF image request (hence why it is called a tracking pixel – the pixel is used to send the data back to the analytics server).

The curtailed example of the list of parameters looks like this:

http://www.google-analytics.com/__utm.gif?utmwv=4&utmn=769876874&utmhn=example.com&utmcs=ISO-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r115&utmcn=1&utmdt=GATC012%20setting%20variables&utmhid=2059107202&utmr=0&utmp=/auto/GATC012.html?utm_source=www.gatc012.org&utm_campaign=campaign+gatc012&utm_term=keywords+gatc012&utm_content=content+gatc012&utm_medium=medium+gatc012&utmac=UA-30138-1&utmcc=__utma%3D97315849.1774621898.1207701397.1207701397.1207701397.1%3B...

 

A request to send data to the Google Analytics server is called when:

  • A new page is requested
  • An event is triggered
  • A purchase transaction occured (a separate request for each item in a purchase)
  • A user segment is triggered

Read more on Google’s Tracking Code Overview 

Cookies

A Cookie is a small text file that is stored on your browser when you visit a website. Cookies can have different uses but broadly they tag you as a visitor to the site and allow settings, logins, shopping carts to remembered as well as visitor analytics.

First Party Cookies vs Third Party Cookies

A first party cookie is owned by the website that stored the cookie. A third party cookie is owned by a different website to the one visited.

Third party cookies are disallowed by Firefox, Safari and other privacy focused browsers. Chrome will also disallow third party cookies by 2022. Third party cookies have been used to map users across websites to deliver retargeting ads and to build a profile of each person.

Data collected from first party cookies can be sent to third parties if the visitor provides consent. This is required for Facebook to collect conversion data for example.

Google Analytics (GA) Cookies

Google Analytics uses first party cookies created by the Tracking Code.

Critically the GA cookies assign a unique clientID to each visitor (unique to your browser and device) . The unique clientID is a combination of a randomly generated unassigned integer and a time stamp.

The Cookies capture information about pages you visit, events, purchases which is sent to the GA server using the pixel image request.

Section 2:

What are UTM Parameters?

  • UTM Parameters provide more information about where a visitor comes from such as the specific Facebook Ad Set or email that the visitor clicked on
  • What are gclid and fclid?

The Google Analytics Tracking Code can use information contained in parameters captured in the URL of the link that the visitor clicked on to come to your site.

UTM Parameters

The most common type of Tracking Parameter is UTM – here is an example of a link with UTM parameters:

‘https//mergebi.com/?utm_source=google&utm_medium=organic’

It consists of two parts: the ‘parameter’ (such as source or medium) and the value (such as google or organic).

Google Analytics (or whatever web analytics tool you use) will assign the source of google and a medium of organic against the visitor.

Note: values are case sensitive – we recommend always using lower case

Google Analytics has 5 standard traffic dimensions it reports on.

  1. Source: This captures the origin the user came from. If a user comes directly to your site then that is captured as [none].
  2. Medium: Think of this as the type of pipe the user came down to get to your site: was it from a link in an email, paid search ad, search engine result, affiliate link, display ad. Social ad etc.
  3. Campaign: This can capture a value about the campaign associated with the link (the name or id of an email campaign or paid campaign.)
  4. Content: This can capture information that helps you identify different ads or email links within a campaign.
  5. Term: This can capture information about the keyword that triggered the ad (paid only.)

 

You can create other UTM Parameters to capture more information and configure Google Analytics to report on those parameters too.

GCLID

Google Ads use an encrypted tracking parameter called gclid (short for google click identifier). It looks something like this:

‘https://mapflo.io/?gclid=Gdr0jSRSdf2YGg542yhjWISJBS’

gclid contains more information about the visit than a standard set of UTM parameters however it can only be decrypted by Google Analytics and only created by a Google property.

FCLID

Facebook also has its own encrypted tracking parameter called fclid. This is decrypted by the Facebook Pixel on your website and information used in your Facebook reporting. Google Analytics can not interpret fclid so you will need to use UTM parameters on Facebook ads if you want Google Analytics to track information about the visit.

Section 3:

How to set up UTM Parameters in Facebook Ads

If you use Facebook Ads then you should be setting up UTM Parameters on every Campaign – the good news is that it is super simple

Image mobile with large buy button

If you want to track the performance of your Facebook Ads in Google Analytics then it’s critical that you correctly set-up the UTM Parameters so you can see which Campaigns and Ad Sets are driving visits and conversions.

How to set up Tracking Parameters in Facebook

You set up Tracking Parameters at the Ad level in Facebook:

Click on the Ads tab > Edit

Then scroll down and click on ‘Build a URL Parameter’

Facebook Ads Click on Build a URL Parameter

Facebook offers dynamic parameters (select from the dropdown) for values such as campaign name.

We recommend using static values such as ‘facebook’ for the Campaign Source and ‘paidsocial’ as the Campaign Medium and then dynamic parameters for the remaining parameters.

You can then copy and paste the same tracking parameters portion of the link for all your ads (Paste the test in the URL Preview into Website URL field on the screenshot above). The Campaign Source and Campaign Medium will always be populated with facebook and paidsocial while the remaining parameters will dynamically update with the relevant values for that ad.

Image of the facebook Build a parameter pop-up

Note also that the Campaign Name and some other parameters will be captured as the original Campaign Name (i.e. if you change the campaign name the parameter will still use the original campaign name).

Lastly, it’s quite common for the same Ads to be used across multiple Ad Sets. Rather than create multiple versions of the same creative it’s better to create one version and then use the ‘use existing post’ option to re-use. This also copies over any URL Tracking you have set-up (though the URL Tracking does not appear in the copied ad overview)

Section 4:

How to set-up UTM Parameters on Google Ads

Google Analytics can read the gclid parameters but if you are using a different web analytics platform then you need to set up UTM Parameters.

image of @ symbol on cloud
By default auto-tagging is turned on in Google Ads. Auto-tagging means using the gclid suffix to your links. This is fine as long as you only use Google Analytics to capture traffic information (If you rely on a different system then you will want to turn off auto-tagging. To activate or turn off auto-tagging go to Settings > Account Settings > Auto-tagging:
screenshot Turn off auto-tagging Google Ads

If you want to include Manual tracking parameters then you can add them by going to Settings > Account Settings > Tracking

(this sets them at an Account level, you can also set manual tracking parameters at the campaign, ad group and ad level)

Screenshot Google Ads add UTM Parameters

You can use a combination of Dynamic and static values. A list of dynamic parameters is visible here: https://developers.google.com/adwords/api/docs/guides/valuetrack-mapping

Google recommends that you use ValueTrack parameters which have a bit more flexibility versus UTM Parameters.

More information on ValueTrack parameters can be found here: https://developers.google.com/adwords/api/docs/guides/valuetrack-mapping

You can use Manual Parameters and Auto-tagging (gclid) together.

Google Analytics will receive two bits of information from each link – to avoid confusion you can set manual parameters to override auto-tagging in Google Analytics.

Go to Settings > Property Settings > Advanced Settings > Allow manual (UTM values) to override auto-tagging (GCLID values).

Screenshot Google Analytics over-ride auto-tagging