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
by Al Taylor
Updated June 10th 2021
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:
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
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.
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.
The most common type of Tracking Parameter is UTM – here is an example of a link with UTM parameters:
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.
- Source: This captures the origin the user came from. If a user comes directly to your site then that is captured as [none].
- 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.
- Campaign: This can capture a value about the campaign associated with the link (the name or id of an email campaign or paid campaign.)
- Content: This can capture information that helps you identify different ads or email links within a campaign.
- 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.
Google Ads use an encrypted tracking parameter called gclid (short for google click identifier). It looks something like this:
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.
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.
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
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 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.
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)
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.
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)
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).