How To Properly Track Campaigns In Google Analytics

Modern digital marketing on the tablet in vintage styleTo say that Google Analytics is a powerful tool is an understatement. Google has created a product that is not only powerful, accurate, and easy to use, it’s also free. As data analysts, we find data fun. It is interesting to open up a client’s Google Analytics data sets and see the trends that their website has gone through over the weeks, months, and years that it has been in existence.

One of the more interesting features of Google Analytics that you may not have ever heard of is the ability to track campaigns from any source. This is a powerful business intelligence tool that can help you see which of your online marketing campaigns are having the most impact. I will explain how to use this feature shortly, but first, a little background:

Google Analytics uses what is called a tracking code to collect data about your website visitors. This tracking code is a small piece of Javascript that is placed in the header section of your website, and it looks something like this (note that the GA account UA account number has been redacted, but this is the way all GA code looks – the only difference is the UA number):

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-XXXXXXX-XX', 'auto');
ga('send', 'pageview');

This little piece of code is what makes Google Analytics work. Basically, it makes a call to the GA servers and requests a small 1×1 pixel element, which it then encodes with data about the visitor’s time on your site – things like number of pageviews, average time on page, etc. – and then sends it back to the GA server, where it is applied to the GA profile of your website. All of this happens in mere seconds, sometimes less.

When you log in to your Google Analytics profile, you can see the data that this little piece of code has collected for you. The amount of data is truly astounding, and can give you incredible insights into how your website is attracting and holding visitors’ attention. But what if you want to know how a particular campaign is doing in sending visitors to your website? Fortunately, there is a very simple way to do this.

Part of the GA code’s job is to show where users came from. This is known as the source, and there are several kinds of sources: organic (from search engines), direct (meaning the visitor typed the website address directly or followed a bookmark), social (from social media sites), cpc (“cost-per-click,” indicative of paid advertising campaigns), and referral (traffic coming to your site from other sites). But what if you had two social media campaigns going at the same time and wanted to know how many you were getting from each campaign? The answer is to build a custom URL. If you didn’t have a custom URL, both campaigns may just show up in your GA as a referral, or even direct traffic.

Custom URLs are a fancy way of telling Google Analytics exactly which campaign a visitor came from. This is part of the power of this tool – it enables you to better track campaigns, leading to better advertising decisions. Implementing custom URLs is incredibly easy.

To do this, you will need a custom URL builder. These are available in abundance, but the best one is the one from Google. There are a lot of fields you can fill in here, but for now, just focus on these four:

  1. The website URL. This is where you will put the URL for the page that you want people to visit in your campaign. For instance, if you want them to visit, you would put that into this field.
  2. The campaign source. This field is one of the most important you will fill in. Here you put in the place that you are putting this URL and running a campaign. For example, if you were inserting your custom URL into a LinkedIn campaign, you would put “linkedin” in this box, or if you were sending people from Facebook, you would type “facebook.”
  3. The campaign medium. This is where you establish what type of campaign it is. For example, if you were simply sharing a URL on your Facebook Business Page, you would type “social” into this box, since it would be social. However, if you were using the same URL in a Facebook ad, you would want to type “cpc” here, or something similar. If you were sending people a URL in an email blast, you would type “email” as the campaign medium, etc.
  4. The campaign name. This field is filled with whatever you want your campaign to be called. For example, if I’m running the above example, and share a URL on both my Facebook Business Page and a Facebook ad, I will want to set up two custom URLs, one from campaign medium “social” (the organic page post) and one from “cpc” (the Facebook ad), and then give both of them a name in this box, for example, “Facebook Post” and “Facebook Ad.” Both of these would have the same website URL and the same source.

You don’t have to worry about “Campaign Term” or “Campaign Content” unless you want to. Campaign term merely identifies the keyword that you are advertising on (in Google AdWords), and campaign content simply allows you to identify different variants of the same ad (for example, if you had two images in your Facebook campaign that you wanted to split-test).

So, if we have a website URL of, a campaign source of Facebook, a campaign medium of cpc (a Facebook ad), and a campaign name of “My Campaign,” the URL builder would give you the following result:

When you set up your campaign in Facebook, you will want to use this URL as the URL for your ad. Users clicking on this URL would take them to the page, but with one important difference – as their visit is recorded by Google Analytics, GA will parse the UTM parameters in the URL – everything behind the question mark – and record that data in your Google Analytics account as well. This will enable you to see how many people are clicking on this exact link in this exact campaign, allowing you to compare marketing placements one to another. You can find this data in Google Analytics in the right hand menu under Acquisition > Campaigns > All Campaigns.

A final note about these custom URLs – it is not necessary to do these for AdWords, as long as you have the auto-tagging feature enabled (which we highly recommend). Google AdWords will automatically append URL parameters to your URLs that are in use within your AdWords campaigns. However, you will want to make sure that your AdWords account is connected to your Analytics account to see that data in Google Analytics.

Custom URLs are powerful and easy-to-use tool to help you better track your marketing efforts, and the insights they can provide you within the Google Analytics interface can lead to better marketing decisions and more business as a result.

Michael is responsible for client SEO work, reporting, FB ads, and web hosting. Prior to joining NSI Partners, Michael received his Bachelor of Science in Business Management Information Systems from Liberty University, and worked at the school’s Network Operations Center. Michael resides in Lynchburg, VA, with his wife, Megan. His hobbies include gaming, watching Atlanta Falcons football, and reading.

Subscribe to our newsletter!

Fields marked with an * are required

About NSI Partners

A digital marketing company with almost two decades of experience, NSI Partners helps clients achieve robust results in search marketing, social media, and other digital marketing spaces.

Leave a Comment

More from our blog

See all posts