There is no doubt that Google Analytics is a prominent web analytics tool. It can provide you with essential traffic stats that can shape the decisions you make about your website. Are you wondering how to add Google Analytics to WordPress? This easy guide will help you set up Google Analytics for your WordPress website with and without a plugin.
How to set up Google Analytics
Let’s see how you can start with Google Analytics.
Step 1: Go to https://analytics.google.com/analytics/web/
The Signup screen will show up.
Step 2: Click on Sign Up. A form will appear. Enter the details. Once you click submit, you will directly see the tracking code for the site you mentioned.
Step 3: Copy the Tracking Code. It starts with “Global site tag (gtag.js) – Google Analytics “
Just these three steps and you are now having the Google Analytics Tracking Code. However, until you add this to your site, you won’t be able to track your website. In the following sections, we will see how we can add Google Analytics to WordPress with and without a plugin.
How To Add Google Analytics to WordPress Manually
Before we proceed with this method, we strongly recommend you to take a backup of your site. Since this is a manual method and you are making changes to your theme, your accidental keystrokes can take your whole site down. Check out our review of 12 Best Plugins to Backup your WordPress website.
Since we are going to make some changes to your WordPress theme, it is recommended that you use a child theme. If you don’t use a child theme, your tracking code can be overwritten every time you update your main theme. You may end up following this process every time there is an update. A child theme will save you from this hassle.
Follow these steps to add Google Analytics to WordPress Manually:
Step 1: Copy the Google Analytics Tracking Code from your Analytics Dashboard
Step 2: Go to the WordPress Dashboard. Click on Appearances>> Theme Editor
Step 3: Locate “header.php” file. Click on it.
Step 4: Paste the tracking code just before the </head> tag.
Step 5: Make sure you click on “Update File” to save the changes you just made.
You have successfully added Google Analytics to WordPress Website.
How to Add Google Analytics To WordPress using Plugins
There are many benefits of using Analytics plugins to add Google Analytics to WordPress. First, they make the task of adding the Tracking code easy. You don’t have to mess up with the code. Second, most analytics plugins feature a dashboard where you can track your website statistics. Our detailed review of the best analytics plugins that you can use to add Google Analytics to WordPress will help you to get familiar with these plugins.
A) CAOS
CAOS stands for Complete Analytics Optimization Suite. You can find this plugin by simply searching CAOS in the WordPress plugin repository.
Once installed, you need to activate the plugin.
To add Google Analytics, simply go to the Basic Settings and Paste your Google Analytics Tracking ID.
Once saved, the plugin will automatically fetch the code. You can decide the position of the tracking code (e.g header or footer.)
This plugin is also compatible with Monster Insights and Analytify. You can enable the settings for these in the Advanced Settings.
Why Use This Plugin?
Have you ever tested the speed of your website on sites like Pingdom and GTmetrix? If you have, you may know the famous “leverage browser cache warning”. If you don’t, read this article to know about leverage browser cache warning and how it affects your website speed. You can use these free tools to check your website performance.
CAOS helps you with the leverage browser cache warning as it saves the Google Analytics Javascript file locally. This helps in increasing site speed performance. This means you get a better score for website performance instead of getting leverage browser cache warning. This is the unique advantage of this plugin.
B) Google Analytics Dashboard for WP
This is the second-most popular plugin with more than 1 million installs. Earlier it was known as GADWP. It provides in-depth data analysis apart from the basic Google Analytics data. It provides performance details for each page and post on your website. It integrates Google Analytics with your WordPress Dashboard. So you can see the analysis right from your WordPress dashboard. It is easy to set up too. It has been translated into 27 languages.
Features:
- Real-Time stats
- Google Analytics Reports; sessions, page views, organic searches, traffic channels, devices, browsers, operating systems, social networks etc.
- Universal Google Analytics
- Cross-domain tracking
- Ecommerce support
- Anonymize IP address
- Track downloads, emails, outbound links, affiliate links, page scrolling depth,
- Use custom dimensions to track authors, publication year and month, categories, tags, user engagement etc.
- Compatible with Multisite
C ) Google Analytics (by ShareThis)
This plugin offers an easy way to add Google Analytics tracking code to your website without modifying any files. The setup is pretty easy and with a few clicks, you are good to go. This plugin is active on more than 5,00,000 websites. Your analytics reports are integrated into your WordPress dashboard. This plugin has a unique feature called ”Trending Content”, it basically shows you the content that is performing significantly better than the average. What’s more, it can even send you an email when content is taking of.
Features:
- Simple setup
- Easy Google Analytics Account Linking
- Visitor trends with page views, pages per session, bounce rate,
- Tracks traffic sources
- Trending Content; In this, you get to see the history of content that is performing better than average
- Trending content alerts
- Only track real visitors: excludes administrators, moderators, editors etc from the analytics so that you get data for the real visitors
- Fully optimized for mobile
- Continuous updating and support
So we have seen how to add Google Analytics to WordPress with and without the help of plugins. We have seen how to get the tracking code and tracking ID by creating a Google Analytics account. We hope this article helped you to get going with Google Analytics for WordPress. Check out our other related articles about the same.