Google Analytics is one of the best tools that you can use to track visitors and various events that are happening on your site. After you write an article you would immediately want to see the traffic that has received and the sources of traffic. I have a couple of websites where I also promote affiliate products and I want also to see the clicks to the affiliate links or other outbound links that I might have. Sometimes I make some Facebook promotions with ads and I want to see the number of visitors that I have on my site and if some of them gone and clicked an affiliate link or other outgoing links in that article.
In this article, I will show you step by step how you can install Google Analytics on your WordPress site and track your affiliate links or outbound links for free.
Do you need help with your projects?
How To Install Google Analytics on Your WordPress Site and Track Link Clicks
Google Analytics is known as it doesn’t need any additional presentation, with it you have the option to add the code directly on your WordPress header and footer and have the visitor tracked. This manual adding will not track the outbound links or affiliates links clicks and you will not have this in your report. Plus with the manual add, in the function of the theme used, you need to know where to add the code.
In this tutorial will use a very well known plugin called MonsterIsights that will help you set up Google Analytics for free and track click statistics. With this plugin, you have also some widgets that will show reports with users directly on your site dashboard. If you don’t have a blog yet you can see my tutorial about how you can have one on How to Start a WordPress Blog on SiteGround. For optimizing it for the best SEO and have traffic from search engines you can also check WordPress SEO Tutorial.
Now let’s dig into the steps you need to follow to have this done:
Time needed: 5 minutes.
Below are the complete steps to set up Google Analytics and track clicks also.
- Set up A Google Analytics Account
You can’t set up Google Analytics without an account so you need to visit Google Analytics and set up an account after you need to add your website to Analytics dashboard to Admin section and add the new site.
- Install MonsterInsights
Now you have the Analytics account ready you just need to add the code on your website and have everything tracked in the right way. MonsterInsights will help you do this in minutes, go to Plugins – add new and search for MonsterInsights as in the below picture and then hit Install and activate:
- Launch Setup Wizard
Now MonsterInsights is installed and you need to configure it. First step is to launch the config wizard and go thru the steps. To launch it go to Insights – Settings and click on Launch Setup Wizard:
- Make The configs
Now you need to go thru the wizard and make the configs for tracking everything:
– Check the site type: My case Publisher Blog
– Connect Monster Insights with Google Analytics account. You just need to hit connect and choose the site from the list.
– Track Affiliate Links – in the Affiliate Link Tracking you place the path you are using for affiliate links, In case you are clocking the links. I am using /go/ for my affiliate links. I am using the plugins from How to Build A URL Shortener with WordPress
– Choose the ones to view the Dashboard Reports ( Administrators)
– Finish and Exit Setup
These was the steps that you need to do to have Google Analytics set up on your WordPress Site and track your links clicks, now you need to sit back and have visitors to have some reports to watch.
Now as you have Google Analytics set up you can go in the Dashboard of WordPress for some basic reports or in Google Analytics for the detailed ones. In Dashboard you have in Free version:
- A widget where shows the total traffic in last 30 days:
- In Insights – report a more detailed one with top pages, day traffic, referals etc
To enhance these reports in the dashboard you need to buy the pro version that it is offering addons for publishers with more advanced reports directly in the dashboard.
In Google Analytics you have all the good stuff like advanced reports with traffic per day, demographics, top pages, and then clicks to your affiliate links or outbound links. You don’t always have affiliate links clocked and that is why tracking outbound link clicks is important. If we check Yesterday we see the below in Analytics:
So you see with this plugin you can monitor everything in detail and make decisions. You can even create some advanced reports to have everything.
AMP Stats Tracking
If you are using AMP on your pages the plugin will not track those for free. To track them you will need to buy the PRO version that will do also AMP tracking. You can monitor AMP traffic for free by setting up the below plugins, below is a mini-guide to set up Google Analytics on AMP in case you have it enabled:
How To Set Up Google Analytics For WordPress AMP
AMP stats can be set up with the help of plugins also, there are a couple of plugins that can help you track stats on AMP pages, the plugins are:
This is a free plugin that will let you do a lot more than tracking AMP stats, it can help you configure AMP or help in displaying ads, etc.
To enable AMP analytics you :
- Install the plugin. As before just search for amp for WP and install it.
- Go into settings and add your tracking id as in below:
In case your WordPress plugin used to enable AMP is not having Analytics integration you can use Glue For Yoast which will help you track AMP stats. This works together with Yoast SEO and in the analytics tab you can set up the Analytics tracking.
Performance Impact of MonsterInsights
I want to have my site as fast as possible and that’s why when using any plugin I need to think of the performance impact that the plugin might have on the site. I have made a test where I test in GTMetrix a page and see the differences between using the plugin and having only the Analytics script in the footer. I am using wp rocket so I have the addon browser caching enabled for Analytics.
Only Script In Footer
As you can see the total page size is bigger then when only using the plugin, also there are more requests when using the script only. This shows that the plugin is not adding any extra performance increase but actually is making things better and helps in monitoring also the outbound link clinks.
This was the guide that will help you set up Google Analytics into a WordPress site in the right way and track also outbound clinks for more advanced reports. In case you want AMP tracking and detailed reports for AMP to better measure everything I recommend getting the PRO version of MonsterInsights