How To – Track Links in WordPress using Google Analytics

google-analytics-thumb
google-analytics-thumb

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.

analytics-url-generator

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.

traffic-source-campaign

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 WordPress plugin. 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-wp-plugin

If you use an affiliate plugin to format your affiliate links into something like this http://www.example.com/out/ then you will have to enable tracking of internal links as outbound links.

internal-links-outbound

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

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.