How to Track Links in WordPress using Google Analytics – Great for Social media Campaigns

I’m trying to run a campaign on social media, but before I do, I need to set up traffic monitoring of social media activity, first.  If you’re in a similar boat, then this article may be for you.


I needed to create landing pages that can be used to count the traffic and redirect back to the intended page.  Then I would need to do create unique referral landing pages, one for Facebook, another for twitter and so on.  This way I can track traffic count for each of my social networks, individually.

I don’t have a big budget for my website and I’m using Virtual Private Hosting to run the show.  My website is running WordPress which is still foreign to me (I only new of it’s existence 6 months ago) and I’m using it because it’s a great blogging platform.

Learning the back-end of WordPress and it’s PHP platform is coming rather more organically for me then learning how to use it.  Rather odd!

So given my situation, I’m happy to do some of the dirty work in developing code on a need-be bases. But before reinventing the wheel, I tried various WordPress plugins that I can find. They seemed complicated, and I’ve spent considerable time searching and trying them.


Okay, after endless searching, I’ve realised there are sites on the Internet dedicated for that.  Google Analytics seems to do the job nicely, for example.  For further discussion on how this can be achieved, the article from wpbeginner is great start!  In add

In summary of what’s discussed in the following article :


Earlier, we wrote about how to install Google Analytics in WordPress, and we have received tons of questions from our users. One of the most commonly asked question was how to track links in WordPress using Google Analytics? Well in this article, we will show you how to track links in WordPress using Google Analytics.

Before we answer that question, lets first talk about why would you want to track links in Google Analytics?

The general idea people have about Google Analytics is that it tells you how many vistors and pageviews you are getting, where the traffic is coming from, and what content is popular on your website. All of that is correct. However, Google Analytics can also provide you information about what users do when they come on your website, which banners or links they click the most, what product placements are working better on your website, which social media campaigns are bringing you more traffic, etc. For example, let’s say that you have a page on your blog where you sell an ebook. You publicize this page through twitter, facebook, various banner placement on your website, email newsletter, etc. Without tracking those metrics, how do you know which method is working the best? Maybe you have the ad for your book in your sidebar, in your footer bar, and after your post content. By tracking those links, you can find which one is working the best. Maybe, the footer bar and the after post banner is working the best, but your sidebar ad is not. Then you should get rid of the sidebar ad and focus on the other two placements. Perhaps, you can try improving your ad and then do A/B testing. By tracking links, you can greatly improve your website by getting rid of items that don’t work and optimizing the ones that do.

Tracking links in Google Analytics using UTM Source

Google Analytics has this amazing feature called custom campaigns. To use custom campaigns, you add UTM parameters to your URL which are then recorded in your custom analytics report. Google Analytics even has a URL Builder tool where you can generate a URL with UTM parameters.

Generating a URL with UTM parameters in Google Analytics

In the example above we have created a link to be shared on Twitter, as a tweet.

  • utm_source parameter identifies the source of traffic this could be a site, a social media network, newsletter, app, etc. In this example we have used Twitter.
  • utm_medium parameter is used to describe what kind of medium we have used, in this example we have used a Tweet.
  • utm_campaign parameter to define a campaign name, slogan, promo code, etc.
  • utm_term parameter is used to identify paid search keywords.
  • utm_content You could be using a variety of content types in a campaign, this element allows you to differentiate among them.

To view stats for your custom campaigns go to Google Analytics Reporting » Traffic » Sources » Campaigns and you will see something like this.

utm source in Google Analytics reporting

Tracking Out-going Links with Google Analytics

With Google Analytics, you can also track outbound links on your website. Outbound links are the links which take visitors from your website to some other site on the web. Understanding which external links are most often clicked on your website will help you understand what kind of information users are looking for. This will allow you to plan your content strategy accordingly.

Google Analytics does not track outbound links by default. To enable outbound link tracking, you need to add a little javascript to your website, and add a little code with each outgoing link that you want to track. This sounds like a lot of work if you want to track all your outgoing links. We will show you how you can enable automatic tracking of all outbound links in Google Analytics with WordPress.

First thing you need to do is install and activate the Google Analytics for WordPressplugin. If you already have Google Analytics code inserted in to your WordPress blog, remove that code. Once you are sure that your WordPress site does not have Google Analytics code, go to Settings » Google Analytics. Authenticate your Google Analytics profile or enter UA-Code manually. UA code is the unique identifier for each Analytics account you create. This UA code can be found next to your website’s profile in Google Analytics Dashboard.

Google Analytics for WordPress Plugin Authenticate with Google or Enter UA code manually

If you use an affiliate plugin to format your affiliate links into something like this then you will have to enable tracking of internal links as outbound links.

Tracking internal links as outbound links

To view the outgoing links, go to your Google Analytics account. In the sidebar click on Content » Events » Top Events. You will see outbound-article as the top event. Clicking on it will show you a list of outgoing URL(s) users clicked on your website.

Outbound Links Events in Google Analytics

Google Analytics is a very powerful tool. It not only helps you learn about your visitors and popular content, but you can also use it to develop strategies to further optimize your WordPress blog. We hope that you find this article useful. If you have used either the UTM tracker or outbound link tracking in the past, then let us know of your experience. If you are using something else, then please share that in the comments below. This way all of us can learn from each other.

Source: How to Track Links in WordPress using Google Analytics

Leave a Reply

Skip to toolbar