How to Track Your Ad Campaigns More Effectively

Online advertising campaigns play a leading role in reaching your target market, but how do you know the right people are getting your message? How do you know that your hard-earned advertising budget is being spent in the right place and that you're actually getting a reasonable rate of return? 

That's where tracking pixels and URLs come in. These tools help identify not only where your visitors are coming from and which campaigns are bringing in the most traffic, but also the sources that are generating a true return on your investment. So, what are they, how exactly do they help you, and what's the difference between the two? 

Tracking pixels

ThinkstockPhotos-480941040What is a tracking pixel?

Primarily used to track conversions for product purchases and signup forms, a tracking pixel is a small, transparent image (1-pixel by 1-pixel) that is usually provided by a third party (such as Facebook or Google) and inserted into a page where you would want to track conversions.

How do they work?

Say you have an advertisement running on Facebook. When someone clicks on it, they are directed to one of your products. You look at your sales numbers and see that you've sold over 1,000 units of that product. However, you also have the same advertisement running on two other sites. How many of those purchases came from Facebook, and what is the ratio of clicks-throughs to purchases?

So, you add a conversion tracking pixel to the final "Thank you!" page that a user sees after successfully checking out. Now, every time that "Thank you!" page is loaded, so is the pixel, and every time that tracking pixel is loaded it sends data about the visitor to Facebook. Facebook uses that information to see if the person who completed the purchase also clicked on your Facebook ad. If they did, then a successful conversion has taken place. By using the pixel, you can now see that out of 1,000 ad clicks, 500 of those resulted in a purchase.

How do you install a tracking pixel?

Every provider has slightly different code that you will have to insert into the HTML of your page. For our example we will be using a fake Facebook pixel. However, the steps will be very similar no matter where the code is generated.

1. Get the pixel embed code

The steps to generate the pixel will vary depending on your ad platform. Below are a few of the most popular sources, with links to their specific instructions:

Your code will probably look something like the following (this is an example of a Facebook pixel):

<script>

(function() {

var _fbq = window._fbq || (window._fbq = []);

if (!_fbq.loaded) {

  var fbds = document.createElement('script');

  fbds.async = true;

  fbds.src = '//connect.facebook.net/en_US/fbds.js';

  var s = document.getElementsByTagName('script')[0];

  s.parentNode.insertBefore(fbds, s);

  _fbq.loaded = true;

}

})();

window._fbq = window._fbq || [];

_fbq.push(['track','1234567890',{'value':'5.00','currency':'USD'}]);

</script>

<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=1234567890&cd[value]=5.00&cd[currency]=USD&noscript=1" /></noscript>

Or, it might look something like this if your provider offers a Javascript-free version:

<img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr/?ev=1234567890&cd[value]=5.00&cd[currency]=USD&noscript=1" />

2. Make sure you can edit your site's HTML code

Now that you have the code ready, you will to need to insert it into your page. This means you will need access to edit your website's HTML. Chances are that your website was built with a content management system (such as Wordpress) or an e-commerce platform (such as Shopify). These systems almost always allow you to add custom HTML and Javascript, but, just like ad providers, the process varies and you will have to refer to your platform's documentation. Below are links to instructions for some of the most popular systems:

E-commerce Platforms

Content Management Systems

The location for inserting custom HTML/Javascript in a content management system will depend largely on how the site was set up by the original developer. Many Wordpress and Joomla themes offer sections for custom analytics and tracking codes on specific pages. If this isn’t provided then you may have luck with the following plugins:

  • Wordpress

o   Tracking Code Manager

o   Facebook Conversion Pixel

  • Joomla

o   Custom HTML Advanced

o   Flexi Custom Code

  • Drupal

o   Code per Node

o   Commerce Conversion Tracking

Raw HTML files

If your site was built with plain HTML files, you can probably edit the file directly inside your hosting provider's control panel, or you can simply download the HTML file from your server (through your hosting provider's control panel or an FTP client) and edit it in a program such as [Notepad++](https://notepad-plus-plus.org/) for PCs or textEdit for Macs (which comes pre-installed).

3. Insert the tracking code

Usually, you will place the tracking pixel code in between the <body></body> tags (which surround all of the visible content on a page), or in between the <head></head> tags (which contain links to scripts, stylesheets, and more). Refer to your ad provider's documentation to find out which area you should place your code in. In Facebook's case, they recommend inserting the code before the closing </head> tag. As such, the finalized snippet would look something like:

<head>

            .

            .

            Page title, metadata, scripts, and stylesheets all appear above the tracking pixel

            .

            .

            <script>

            (function() {

            var _fbq = window._fbq || (window._fbq = []);

            if (!_fbq.loaded) {

            var fbds = document.createElement('script');

            fbds.async = true;

            fbds.src = '//connect.facebook.net/en_US/fbds.js';

            var s = document.getElementsByTagName('script')[0];

            s.parentNode.insertBefore(fbds, s);

            _fbq.loaded = true;

            }

            })();

            window._fbq = window._fbq || [];

            _fbq.push(['track','1234567890',{'value':'5.00','currency':'USD'}]);

            </script>

            <noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?ev=1234567890&cd[value]=5.00&cd[currency]=USD&noscript=1" /></noscript>

</head>

And that's it! Once the tracking pixel has been added to the page you can start analyzing your conversions and more accurately invest in the advertising portals that provide the greatest return.

Tracking URLs

What is a tracking URL?

A tracking URL is simply a regular URL with additional parameters appended to it, which contain extra information such as the referral source or the name of your ad campaign. As an example, a regular URL looks like:

http://www.mysite.com

A tracking URL looks like (note the additional letters starting with the question mark after the .com):

http://www.mysite.com?campaign_name=august-promotions&source=email

If someone were to click on the first link, it would simply take them to your website. If someone clicked on the second link it would also take them to your website, but the extra URL parameters would tell your analytics suite which ad campaign drove them there and whether they were referred from an email, website, etc.

When should you use a tracking URL?

Email marketing, advertisements on other sites, social media posts, or even links in the description of a YouTube video. As a rule of thumb, if you are linking to your site from an external source (i.e., not your own website) you should use a tracking URL.

How do you use a tracking URL?

The hardest part is generating the URL itself, since the parameters vary depending on what analytics suite you use. Fortunately, building these is a relatively painless process, thanks to URL builders. Just choose the analytics suite you use below (if in doubt, Google Analytics is a safe bet, as Google's UTM Parameters are used by quite a few other analytics systems, such as Kissmetrics):

Once you have created your URL you can use it anywhere that you normally would in your ad campaign (calls to action, banner ads, general links, etc.). If you have a segmented email blast, make sure you have a separate tracking URL for each segment. If you're running ads on three different websites, make sure each website gets their own tracking URL. Then, at the end of the day, you can see which emails, ads, and referrers have performed the highest.

So, which one should I use? A tracking pixel or a tracking URL?

The short answer is: both! Utilizing tracking URLs will allow your analytics platform to give you insight into the sources and ad campaigns that are driving traffic to your site. Hubspot’s “Sources Report,” for instance, will use this information to show you exactly how visitors have been discovering your business.

Couple that with tracking pixels, and you will be able to see which ad platforms are generating the most conversions, along with additional data such as the cost-per-conversion. You can then leverage this data, along with the information derived from your tracking URLs, to further refine and invest in the ad platforms and delivery methods that prove to be most effective for your business.

Managing ad campaigns can be confusing. Hubspot helps.

Creating ads, tracking conversions, setting up tracking URLs, identifying target markets, and spending countless hours crunching numbers to find out the actual value that each advertisement is bringing to your business is tedious work. Add in all of the different ad providers and their separate, proprietary interfaces and what was monotonous quickly becomes overwhelming.

Fortunately, in addition to the already impressive feature-set that they provide, Hubspot recently introduced a tool to consolidate all of this hassle into one convenient package: the "Hubspot Ads Add-on." Built to enable you to track, create, manage, and audit your own ads all in one convenient, consolidated location, this add-on aims to make the complicated world of ad campaigns clear, easy to use, and enjoyable. Find out more at http://www.hubspot.com/products/ads or contact DMD to learn more.

Inbound Marketing FAQs

Posted by Harrison Okins

Harrison Okins

Harrison Okins is a California-based web designer/developer who spends his time creating beautiful and functional things. He also thoroughly enjoys laser tag and typography.

Subscribe for inbound marketing and sales tips!

Recent Blogs