NEW
Now available: click fraud protection for Facebook and InstagramLearn more
Now available: click fraud protection for Facebook

Tracking Code

|

What is a Tracking Code?

A tracking code is usually a snippet of JavaScript or an image pixel that collects and sends data to a tracking tool, such as Google Analytics or Facebook. It is embedded in the pages of a website or in emails to monitor user behavior like interactions with an email or form, to track conversions or sales, and generally helps you understand the effectiveness of your digital marketing campaigns.

What does a Tracking Code look like?

Here are a few examples of tracking codes:

Google Analytics Tracking Code: A JavaScript snippet placed in the header of a website to track visitor behavior:

				
					<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-[Your Account ID]"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-[Your Account ID]');
</script>
				
			

Fraud Blocker Tracking Code (our company): A code used to track visitors to help with ad fraud prevention:

				
					<!-- Fraud Blocker Tracker -->
<script type="text/javascript">
  (function () {
    var s = document.createElement("script"), 
      h = document.head;
    s.async = 1;
    s.src = "https://monitor.fraudblocker.com/fbt.js?sid=[Your Account ID]";
    h.appendChild(s);
  })();
</script>
<noscript>
  <a href="https://fraudblocker.com" rel="nofollow">
    <img decoding="async" src="https://monitor.fraudblocker.com/fbt.gif?sid=[Your Account ID]" alt="Fraud Blocker" />
  </a>
</noscript>
<!-- End Fraud Blocker Tracker -->
				
			

UTM Parameters: URL parameters used to track the effectiveness of online marketing campaigns across traffic sources:

https:/yourwebsite.com?utm_source=google&utm_medium=cpc&utm_campaign=2024-special-guide&gclid=123456

How do Tracking Codes work?

Tracking codes work by executing a script when a user visits a website or interacts with an email. This script collects data about the user’s actions, including pageviews, clicks, and conversions. The data is then sent to the analytics platform, where it is processed and available in reports for you to analyze.

What types of Tracking Codes are there?

There are many methods to implement tracking, and here are a few common types:

JavaScript Tracking Snippets: Commonly used by web analytics platforms like Google Analytics to collect data on website usage.

Conversion Pixels: Small, transparent images embedded in websites or emails, used to track user conversions and actions.

Event Tracking Codes: Implemented to monitor specific actions on a website, such as form submissions or video plays.

Custom Tracking Codes: Tailored codes designed to capture specific data points relevant to unique business needs.

UTM Tracking Codes: UTM Tracking is not code snippets, but they are parameters added to your URLs to track the performance of marketing campaigns across different sources and mediums.

Benefits of using a Tracking Code

To Analyze Performance: Provides detailed insights into the effectiveness of marketing campaigns.

To Improve User Experience: Helps identify usability issues, and can help you uncover specific areas where you can improve user experience.

To Make Data-Driven Decisions: Tracking codes help you build a solid foundation of data for making informed marketing and business decisions.

Best practices when using Tracking Codes

Tracking codes are powerful when used correctly. Below are a few tips to get the most out of your tracking:

  • Minimize Code Duplication: Make sure your tracking codes are not duplicated across pages to prevent skewed data.
  • Keep Codes Updated: Regularly check for updates from your tracking tools, and leverage the latest features to maintain accurate tracking.
  • Use Tag Management Systems: Implement a tag management system to streamline the management of tracking codes and reduce website load times. Google Tag Manager (GTM) is a commonly used tag management tool.
  • Check Your Privacy Compliance: Be transparent about your data collection practices and comply with regulations such as GDPR and CCPA. This is very important to check for your country or region, as rules may vary widely depending on your location.

Common mistakes when using Tracking Codes

You’ve probably heard the phrase: “bad data in, bad data out”. In this case – that is true, and you need to make sure your tracking codes are giving you good data. Here are common mistakes we see:

  • Incorrect Implementation: This is the most common and biggest issue. Misplaced codes or incorrect installation can lead to inaccurate data.
  • Overlooking Mobile: Failing to make sure tracking codes work seamlessly on mobile devices can result in incomplete data. This is especially true if you have both a website and app.
  • Neglecting Regular Audits: Without routine checks, tracking codes can become outdated or malfunction, compromising data integrity.
  • Ignoring User Privacy: Not adhering to privacy laws and user consent requirements can lead to legal issues and damage to brand reputation.

Frequently asked questions

How can I check if my tracking code is working?

Use tools like Google Tag Assistant or Facebook Pixel Helper to verify that your tracking codes are firing correctly.

Can tracking codes slow down my website?

Yes. Some tracking codes are ‘heavy’ – meaning that do a lot of things that require a lot of time to load or process. Using a tag management system can help mitigate this risk, but not always.

Do I need separate tracking codes for each marketing platform?

Generally, yes. Each platform – Google Analytics, Facebook, X (Twitter), etc. – has its own tracking code or pixel for collecting data specific to that platform.

Jump to section