Google Analytics is super valuable when it comes to measuring website user behavior and tracking conversions. However, installing Google Analytics on WordPress can be tricky which is why I put together a post on how to add Google Analytics to WordPress.
Why WordPress? WordPress is a super popular platform, and according to some of the most recent stats, 30% of the web is powered by WordPress.
That coupled with over 40 Millon sites using Google Analytics to track site visitors means that there is a shi**oad of Google Analytics WordPress out there.
Since a proper Google Analytics install is critical to accurately tracking users, I provide three different approaches on how to Add Google Analytics to WordPress.
How to Add Google Analytics to WordPress Using a Plugin
The easiest way to install Google Analytics on WordPress is to use a Google Analytics WordPress plugin. You can go two ways with this approach.
If you want to get the tracking code in place and are not looking for any additional features, you can use GA Google Analytics a Google Analytics WordPress plugin built and maintained by Jeff Starr.
This is a simple way to get up and running quickly.
However, there are more robust Google Analytics WordPress plugin options available if you are looking to pull in reporting dashboards directly into your WordPress site.
Many of these Google Analytics WordPress plugins also have granular tracking and some customization features that can be applied.
Keep in mind that the more robust tools require a more extended setup and also work on a freemium pricing model.
The drawback with relying heavily on plugin functionality is potential compatibility with your site, lack of unique customizations and dependence on the plugin working correctly with the Google Analytics API. (future proof)
There is one other plugin, Analytify, I would like to highlight above the others. Analytify has a 4.5 star rating and over 70,000+ installs. They are also actively supporting and updating their plugin on an ongoing basis.
With the Analytify WordPress Google Analytics Plugin, you can easily Integrate your WordPress website with Google Analytics and view your Website Analytics within your WordPress dashboard.
Let’s go through the steps steps of integrating Google Analytics with Analytify.
How to Integrate Google Analytics with Analytify
1. Login to your WordPress website
2. Next, go to Plugins, click on Add New and search for Analytify.
3. Now Install and Activate “Google Analytics Dashboard Plugin for WordPress by Analytify” on your WordPress website.
4. Then, navigate to Analytify in your WordPress website dashboard and click on the Setting option to integrate with Google Analytics.
5. After clicking on the Setting Option the Authentication Window will open where you can log in with your Google Analytics account.
6. Click on Log in with your Google Analytics Account and select your Google Analytics Account in the new window.
7. After Selecting the Account, a new window will open where you have to allow account access by clicking on the Allow button and a new window “Profile” will open in your WordPress Dashboard.
8. In the Profile window you will find two options:
Profile for posts (Backend/Front-end)
Profile for Dashboard
You have to select the same Google Analytics account for both of these options. Then click on the Save Changes button.
9. To view the Analytics of your website within your WordPress Dashboard go to Analytify and click on the Dashboard option.
That’s it! You can now view all your critical analytics data directly in your WordPress Dashboard.
How to Add Google Analytics to WordPress with a Header & Footer Script Inserter
You can also add Google Analytics to WordPress by placing the Google Analytics script in one of these plugin fields.
That is if you are not working with a framework, i.e. Genesis or Thesis which already have a script field built into their Framework. For example, Genesis provides the following field under settings.
If you are working without a Framework and are using the native WordPress install, you can use a plugin for adding WordPress Google Analytics script.
For example ‘ Head and Footer Scripts Inserter’ allows you to Hook into the Header and Footer sections of your site adding custom tracking scripts.
Alternatively, if you can access your functions.php file and are comfortable making edits you can always Hardcode the Google Analytics WordPress Script in the Functions File.
This is pretty straightforward, and you can reference these sources for the specific code:
Install Google Tag Manager on WordPress
For the third option, you can install the Google Tag Manager plugin then install Google Analytics via GTM to Add Google Analytics to WordPress.
This is the more robust and most flexible version.
If you ask me it is the best approach since you are setting yourself up to be highly flexible with the ability to customize your tracking on an ongoing basis.
You are also not limited to Google Analytics tracking and can install other essential tracking snippets such as the Facebook Pixel.
The plugin I use for this is
DuracellTomi’s Google Tag Manager for WordPress it is super powerful works seamlessly for Google Tag Manager and can even push page meta info into data layers.
I will cover the basic set up for the Google Analytics tracking here, but these set of tools have so much more to offer.
So if you are an expert knock yourself out 🙂 and if you are a beginner then as you learn and expand your tracking and analytics expertise you are already set up for success.
Setting Up The Google Tag Manager Plugin
Ok let’s get started:
(The assumption is that you already have a Google Analytics and Google Tag Manager account and of course a WordPress site)
First, go to the plugin page and download the plugin file.
Then upload the plugin to your WordPress site and activate it.
Alternatively, you can search for the plugin in the directory and install it that way.
Once the plugin is active, let’s go over the basic set up.
You can find the plugin under Settings > Google Tag Manager
First Enter your GTM Container ID
The other tab I will cover briefly is Posts under the Basic Data tab. This writes data layers to the source code that you can then use in Google Tag Manager.
You can see I have Post type, Category and Tags selected.
Pulling these into the data layer allows me to create custom firing rules in Google Tag Manager.
You can learn more about the plugin and in the support section.
Setting Up Google Analytics With Google Tag Manager
Since this post talks about how to add Google Analytics to WordPress, I will include the basic set up of Google Analytics in Google Tag Manager. For a more comprehensive guide you can reference this complete guide to adding Google Analytics to WordPress from Tommy Griffith.
First, go to your GTM account, click create a new tag and give it a name.
Choose Universal Analytics as the Tag Type.
Set you Track Type to Pageview Enbabel the Override Setting and enter your Google Analytics ID or Constant Variable containing the ID.
Now add the trigger to fire on all pages.
Click save, and your Tag should be all set.
Before you publish hit preview and make sure the tag is firing correctly.
If all looks good, you can submit and publish.
Note: To validate tracking I always use the Google Tag Assistant chrome extensions. Well worth the install 🙂
If you cannot measure how people are interacting with your site, then you do not know what actions are driving conversions.
Besides, if you capture inaccurate user data, you could be making misinformed vital decisions that negatively affect conversions.
Tracking users is essential but tracking users accurately is critical.
What set of tools have you made use of to Add Google Analytics to WordPress?
Do you rely on a Google Analytics WordPress plugin or find them too limiting?