How to Install Google Analytics on WordPress - WordPress SEO

How to Install Google Analytics on WordPress

If you do not have Google Analytics set up on your WordPress site, then you are missing out on a treasure trove of data that can help optimize your website, resulting in more conversions, more traffic, and more revenue.

Luckily for you, Google Analytics is quite easy to set up and can be installed within 5-10 minutes.

In this article, I am going to show you exactly how to install and set up Google Analytics as well as enabling E-Commerce tracking so you can see e-commerce revenue in Google Analytics.

This will allow you to see where your orders come from, popular products and ROI on your marketing.

First, let’s talk about what Google Analytics is.

What is Google Analytics?

Google Analytics is a free analytical tool created by Google, available to anyone who runs a website, blog or online property. It not only measures your website’s traffic but can also provide statistics and in-depth data on:

  • The speed of your website
  • Whether the site is mobile-friendly
  • How many visitors end up as a customer
  • What part of the world your visitors are in
  • Which websites drive traffic to yours
  • How long visitors spend on each page
  • Which marketing tactics are the most successful

Setting up Google Analytics on your website is very simple and you just need to add a small piece of javascript code to all the pages you want to track. But before we get into that, why should you should Google Analytics?

Why Use Google Analytics?

Google Analytics can give you a ton of great insights about how your website performs, what actions people are taking on your website and other important KPIs to help you better optimize your website and business.

Add Google Analytics to WordPress

Setting up Google Analytics on your WordPress website is super easy to do. Adding the small Google Analytics tracking code to WordPress is simple and can be done in a few different ways.

First, we are going to show you how to get your Analytics Tracking code.

Just head to Google Analytics, create a free account and click ‘ADMIN’ at the top.

add analytics to wordpress

Select Tracking info under the property column of the admin area and then click ‘Tracking Code’.

js tracking info analytics

Once you are on the Tracking Info page you have access to your Tracking ID as well as your website tracking code.

google analytics tracking code

If you want to add Google Analytics tracking code to your footer.php, you will need the website tracking code.

If you want to use a plugin to add Google Analytics, you will only need the Tracking ID.

Adding Google Analytics To WordPress Manually

To add your Google Analytics code manually without installing a plugin, copy the entire website tracking code.

Log in to your WordPress wp-admin backend and go to Appearance->Editor.

appearance editor wordpress

Once you are in your theme editor, look in the right column under Templates for Theme Footer.

Click Theme Footer to edit the footer.php page.

Scroll all the way to the bottom and paste your Google Analytics Tracking code right before the closing </body> tag.

wp footer wordpress

Google Analytics is now installed on your WordPress website.

Install Google Analytics on WordPress using a Plugin

Installing analytics using a WordPress plugin is easier than the method before, but I would recommend using the least amount of plugins possible.

Install the Google Analytics Plugin by MonsterInsights.

Once the plugin installed, you will see a new tab on the left menu called, ‘Insights’.

monster insights analytics

Click Settings to set up your analytics via this plugin.

In the Insights Settings page, you will have to connect your Google Account so that Monster Insights can install the tracking code on your WordPress website.

authenticate google

Click the authenticate with your Google Account button and you will be prompted to allow MonsterInsights access to your analytics data.

monster insights authenticate

Click Allow and you will get a code.

Copy the code and go back to the Settings page and paste it on the authentication box.

confirm analytics code monster insights

Once you have authenticated the app, you can choose which of your Analytics properties you want to install on your WordPress site.

choose analytics profile

Click save changes and your Analytics tracking code is now installed on your WordPress website.

How to Enable Ecommerce Tracking In Google Analytics

If you have an ecommerce store or take credit cards online, you can set up Ecommerce Tracking to see ecommerce data right in Google Analytics.

This allows you to see your average order size, where orders are coming from, advanced demographics and more.

To enable Enhanced Ecommerce Tracking simple go to your Google Analytics admin area.

In the View column, look for the Ecommerce settings.

Choose ‘Enable Ecommerce’ to turn on the ecommerce tracking in Analytics.

analytics ecommerce setting

Now you will need to set up some custom code on your site that will connect your store to Google Analytics.

With WordPress

If you have WordPress, you can use a plugin like Enhanced Ecommerce Google Analytics Plugin for WooCommerce to easily install Ecommerce Tracking on your Woocommerce enabled website.

Simply install the plugin on your WordPress website, and then add your Google Analytics ID in the plugin and you are all set up!

enhanced ecommerce settings

If you already have Google Analytics tracking installed, then uncheck ‘Add Global  Site Tracking Code’ so that there aren’t 2 tracking codes installed.

After that, click Save and you are complete. You should now see ecommerce data in Google Analytics. It may take some time to see the data so make a few test orders and wait an hour or 2 to test.

With Shopify

Alternatively, with Shopify, you can easily set up Enhanced Ecommerce Tracking by following these steps:

  1. Open your Shopify admin.
  2. Go to Online store > Preferences.
  3. In the Google Analytics section, click the Use Enhanced Ecommerce checkbox. If you’re using an older version of Google Analytics, then you might need to click Upgrade to the latest version before you can click the Use Enhanced Ecommerce checkbox.
  4. Click Save.
  5. In your Google Analytics account, click Admin.
  6. In the View menu, click Ecommerce Settings.
  7. Click the Enable Enhanced Ecommerce Reporting toggle to turn it from OFF to ON.
  8. Click Save.

Wrapping Up

Now that you have Google Analytics set up on your website, you can track important KPIs and traffic coming to your website and store.

With Google Analytics, you can measure how your website is performing, where visitors are coming from and how they are interacting with your website.

Leave a Reply

Your email address will not be published. Required fields are marked *