Blog

Set-up Guide for Google Analytics for Small Businesses on WordPress

Set-up Guide for Google Analytics for Small Businesses on WordPress

Plugins come and plugins go, but WordPress and Google are here to stay.

While many webmasters simply resort to using plugins developed by generous authors to include Google Analytics and Tag Manager in their WordPress websites, there’s no telling when said plugins can mess up the scripts or safety of your website (it’s not paranoia if more than 22% websites actually do get hacked via plugin vulnerabilities).

For the rest of us who can rely on our own skills of copying and pasting code, let’s take a gander at what it takes to correctly include and use Google Analytics and Google Tag Manager into WordPress websites for rapidly growing small businesses.

The Introductions:

For those of you who are unaware or somewhat in doubt, take a look at what the two tools are:

Google Analytics:

Google Analytics (Standard) is a free code snippet that, once added, collects, consolidates, and filters data about your website traffic and turns it into insightful reports to help your business learn and grow with strategic action.

Google Tag Manager:

Google Tag Manager is also free and a place where you can manage all your code snippets that have been added to your website for data tracking. Essentially, it’s a dashboard that lets you easily add and manage tags (code snippets) from Google, 3rd party vendors, or your own for analytical data collection and tracking

You can add Google Analytics (and more) to your site via the Tag Manager. The following steps will explain how to do that.

Note: Make sure you have a Google Account and you are signed in on that.

The Set-up:

Step 1. Sign in to Google Analytics

Go to https://www.google.com/analytics/ and click Sign In >> Google Analytics. You’ll be brought to the following screen :

  1. Fill requisites: Account Name, Website Name, and the URL of website (www.example.com)
  2. Set Industry Category and Time Zone: Small businesses should select ‘Business and Industrial Markets’ and their local time zones (for best results)
  3. Click ‘Get Tracking ID’ and you get a Universal Analytics tracking ID.

You are brought to Admin section, where you’ll see the Tracking ID.

Make note of this Tracking ID. We’re going to need it.

Step 2. Sign In to Google Tag Manager

Go to https://www.google.com/analytics/ and Sign In >> Google Tag Manager with the same account you used on Google Analytics. You’ll be brought to the following screen:

  1. Fill requisites:Account Name and Setup container (website/app URL).
  2. Click ‘Create’

You are brought to a screen that gives you code snippet for Google Tag Manager. Copy and paste it on a notepad.

This code creates a GTM container tag that pulls data from HTML DOM of a website via JavaScript. Click OK and you’ll be brought to this screen:

Your installation is almost done. The next step takes you to your website.

Step 3. Add Tag Manager Code in WordPress

You can do this directly on your Themify theme. Simply go to your WP Admin > Themify theme > Themify Settings > General. Scroll down to the Header Code and paste the Tag Manager code. Then save and close.

For third-party WordPress themes, you can do this by going to your WordPress installation folder > wp-content/themes/Your-current-theme/header.php

  • Open this file and paste the code from ‘Install Google Tag Manager’ screen right after < body > tag.
  • Save header.php and close

Step 4. Add Google Analytics via Tag Manager

In Container section, click New Tag. You’ll be brought to this screen:

  1. Choose Product >> Google Analytics
  2. Choose a Tag Type >> Universal Analytics
  3. Configure Tag:
    1. Add Tracking ID (as gathered from Step 1.) and paste it here.
    2. Enable Display Advertising Features.
    3. Optional: Under More Settings >> E-commerce Features, users can Enable Enhanced E-commerce Features (along with Data Layer) only on Page Views.
    4. Click Continue.
  4. Fire on: All pages.
  5. Click ‘Create Tag’

We are almost there.

Step 6. Publish Container

To push the tag on your website, click the red Publish button on the upper right corner of your screen. Then click Publish Now and Done.

TL; DR

Google Tag Manager is not a substitute for Google Analytics. It is only a desk from which you can easily work with and implement Analytics on your websites.

  1. Sign in to Google Analytics (A Google account will be all you need) to get the Universal Analytics Tracking ID.
  2. Sign in to Google Tag Manager with the same account you used in Step 1. Copy the code you receive once you fill the form.
  3. Paste this code to your header.php file of current theme (Found in wp-content/themes/Your-current-theme) after the < body > tag. Tag Manager is now installed in your WordPress website.
  4. Add Google Analytics by creating and publishing a tag through Tag Manager (see Step 4. Of the Set-Up for more details).
  5. Publish this container, and you’re done.

Using Google Analytics for Small Businesses:

Now that you have setup Analytics, it’s time to configure it for best results. What you need to do is:

1. Set Up Goals

Back on your Google Analytics >> Admin Screen, start with setting up goals of 4 types: Destination (User reaches a specified page), Duration (User spent at least the specified time on your website/app), Pages/Screens per Session (as viewed by the User), and Events (Clicked a button, watched a video, downloaded a file, etc.).

Goals are an important part of conversions and let you map how far you have come, and how far you have to go.

2. E-Commerce Tracking

In the guide above Step 4 (3c) we enabled Enhanced E-commerce features before publishing the tag on WordPress. This enables Google Analytics to track e-commerce attributes like products and sales performances, transactions, time-to-purchase and more. This feature is a must. Make sure you have enabled it (go to Admin >> View >> E-Commerce Settings to enable them) .

3. Demographics and Interests Reports

Reporting >> Audience >> Demographics >> Overview

This section includes reports for Age, Gender, and Interests category. When you check the box for Enable Display Advertising features (as mentioned in Step 4. 3b) and enable the Advertising features in Analytics, you can harness this reporting feature to get a better understanding of who your users are and target them more effectively. You can also segment other analytics data to see how your converting and non-converting users differ and adjust your ad campaign strategies accordingly.

4. Behaviour Overview

Reporting >> Behaviour >> Overview

This section helps you find what you are doing right (or wrong). Behaviour Overview gives you an analytical insight on how users are exploring your content.

This is a particularly good feature to use and understand for marketing and UX testing.

  • a. Diagnose Landing Pages : Under Behaviour >> Site Content >> Landing Pages, you get data about the page(s) through which users entered your site/app. The data you’ll need to pay special attention to is Bounce Rate (percentage of visitors who left your site/app after viewing just one page). If it’s higher than your Goal Conversion rate, you have a problem and you should work on modifying your landing pages.

    b. Identify Popular Content : Under Behaviour >> Site Content >> All pages, you get data about every single page/screen of your site/app. The metrics to focus on are Bounce Rate (visitors leaving without going further than this page/screen) and Average Time on Page (average time visitors spent on a single or a group of pages/screens).

    c. Site Speed Overview: Under Behaviour >> Site Speed >> Overview, you get average load sample times of pages/screens of your site/app to help you determine and improve your performance. The data on average page load speeds can be segmented by Browser, Country, and Page URL to more accurately pinpoint any problems

    d. Events Overview: Under Behaviour >> Events >> Overview lies the real ‘star’ of Google Analytics (in my humble opinion), i.e., Event Tracking. For interactive (or even non-interactive) elements on web pages/screens, event tracking is your best friend

Here’s a brief How-to on Setting up an event tracking tag to record number of form submissions via Google Tag Manager:

Step 1. Create a New Tag (Name it Form_tracking or something similar for comprehension. Product: Google Analytics. Tag Type: Universal Analytics. Configuration (Track Type): Page View. Set it to fire on All Pages.

Step 2. Create a Trigger. Event: Form Submission. Configure: Wait for Tags (max. wait time = 2000 ms) and Check Validation. Enable When: Page URL contains form.html (or the link to your forms). Fire on: All forms.

Step 3. Create a new tag (Example: “Submission_Track). Product: Google Analytics. Tag Type: Universal Analytics. Configure Tag:

  • Track Type: Event
  • Category: “Forms”
  • Action: “Submit”
  • Label: “Lead Generation

Step 4. Fire On: Form. Select The Trigger you created in Step 2 (My Form Submission).

Step 5. Step 5. Create the tag. Save a version of this container and publish it (once you have previewed the changes).

Once fired, this tag will track form submissions that Google Analytics will report in your Behaviour >> Events tab. Remember that you’ll have to create individual tags for interactive elements that you want to track. It’s a good idea to map the significant elements out beforehand.

The Upshot

Google Tag Manager makes Analytics implementation so much easier than ever for those unfamiliar with coding. This is why it is the preferred way (and not just for non-coders) to use Google Analytics and its various features, which would otherwise require direct delving into JavaScript.

It’s your turn to statistics into insights that help your business grow.

So what are you waiting for?

Author Bio:

This article is written by Tracey Jones, a renowned web developer who works with HireWPGeeks Ltd. When she is not developing websites, she helps her clients to Hire WordPress Developer from the team of 150+ experts. She also has a strong passion for writing blogs and articles about technical stuffs in her free time.

26 Comments

  1. Marloes
    Jan 07, 2016 @ 00:14

    Amazing article!
    I still feel that Google Analytics and the Tag Manager are gravely under utilized. You can do so much with those two programs, they are free and provide a lot of useful data.

    What a lot of my clients tell me is that they get lost in Analytics. It can be overwhelming and finding the data that you need time-consuming. Dashboards are a welcome problem solvers in those cases.

    Reply

  2. Techician
    Jan 10, 2016 @ 19:27

    Thoank You Tracey Jones, for a cool article. Now i will setup google analytics to check my blog stats. Nice share :)

    Reply

  3. Ben Armstrong
    Jan 13, 2016 @ 15:41

    Google Tag Manager should be placed immediately inside the tag and not in the . Would adding this to header.php be overwritten when the theme (e.g. Themify Ultra) is updated?

    Reply

    • Nick @ Themify
      Jan 14, 2016 @ 22:55

      Hi Ben,

      Please try to edit the core theme files as your changes will be overwritten when the theme is updated. To add code in header or footer, go to Themify panel > Settings > General, then insert your code in Header Code or Footer Code textarea.

      Reply

  4. Rayhan
    Mar 04, 2016 @ 05:48

    Hello Jones,
    It is really a fantastic article. Thank you very much for this. But I have a question – Is there any problem if I use any plugin to set up analytics on my site?

    Reply

  5. Karan Bhagat
    Apr 19, 2016 @ 06:17

    Hello Tracey,

    I have set up Google analytics for the blogs but now going to set it for business websites, thank you for making my work easier.

    Best Regards,
    Karan

    Reply

  6. Milton Andrade
    Jun 14, 2016 @ 21:00

    Great article helped me to understand to use the Google Tag Manager, thank you. hugs

    Reply

  7. Tracey
    Jun 22, 2016 @ 13:06

    I know, right? So many people don’t even know the difference between these two awesome Google products that I just had to write this tutorial.

    So glad it helped you, Milton. :)

    Reply

  8. Glenn Slaughter
    Oct 06, 2016 @ 20:42

    omg THANK YOU for this line:

    “Go to https://www.google.com/analytics/ and click Sign In >> Google Analytics. You’ll be brought to the following screen ”

    I’ve been on a bunch of help sites and NO ONE says how to get to the page! I don’t have any option for it on my WordPress dashboard page either! It’s only a summary that shows for Google Analytics there.

    Reply

  9. Justin Ashton
    Nov 15, 2016 @ 05:07

    Decent article but now there are a couple issues that I see everyone asking about in the Themify forums:
    1) this article is now out of date as the code snippets that GTM is outputting. GTM wants users to post snippet into the and then a second snippet into . So, the instructions are a little off for GTM.

    2) Placing GTM code in the Themify settings Header code box (as instructed) may or may not work for users. Plus, there is no easy way to insert the code without creating a child theme or installing plugins.

    Even themify support gurus are recommending downloading a plug in to install GTM. Can you please deprecate or update this article with a decent fix as its causing confusion. Thanks

    Reply

    • Justin Ashton
      Nov 15, 2016 @ 05:10

      clarifying point 1) above since comment software didnt like html tags,

      “GTM wants users to post snippet into the “head” and then a second snippet into the “body”..

      Reply

  10. Raheel Cheema
    Aug 08, 2018 @ 06:44

    Hello Tracey Jones,

    Thanks for sharing this useful article with all of us. I also learnt more many things from this blog about analytics and tag manager. I also running a small business and sometimes these articles and blogs helps me alot. Thanks for sharing again.

    Reply

  11. Martin Brendan
    Aug 16, 2018 @ 13:30

    I found this much useful blog about google analytics. Google analytics is very important part of SEO service. Very beneficial tool for website. You share the information is very helpful. Thanks!

    Reply

  12. Techshali
    Dec 03, 2018 @ 05:28

    That’s really helpful guide. It took me just a few minutes to set up analytics on my site through this guide.

    Thanks!

    Reply

  13. Nilla Palmer
    Dec 19, 2018 @ 20:54

    Techshali, I just followed this guide, but it is outdated. How did you publish your Container? There isn’t a red Publish button and now I can’t publish the container in GTM.

    Reply

  14. Ellie Windler
    Feb 05, 2019 @ 07:43

    Thanks for sharing useful guide about how to integrate google analytics to wordpress via GTM.

    Reply

  15. Amna Sheikh
    Mar 07, 2019 @ 04:45

    Much need guide for WordPress beginners!
    Thanks you so much.

    Reply

  16. shibi
    Mar 29, 2019 @ 07:53

    Great stuff. Thanks for the sharing. Keep blogging

    Reply

  17. Nina Marini
    Jun 03, 2019 @ 09:22

    For people (like me) trying to setup the current version of Google Tag Manager (as of June 2019), which includes a 2nd code snippet that is supposed to come after the tag, there is a topic on Themify support forum :

    https://themify.me/forum/topic/google-tag-manager-4

    Reply

    • Amanda Englund
      Aug 11, 2019 @ 16:49

      Thank you Nina! Do you know if i need to choose any Conditions on the hook…?

      Reply

  18. Susanne
    Jul 04, 2019 @ 05:40

    Thank you for you sharing. The article is very helpful. It’s help me to analyze and tag.

    Reply

  19. Yana PALTSEVA
    Oct 02, 2019 @ 12:38

    The article mentions only the adding Google Tag Manager’s code in the WordPress, should I also add a Google Analytics code in my WordPress?

    Reply

    • Csaba @ Themify
      Oct 03, 2019 @ 21:31

      Hi Yana,

      Please check the Step 1 of the tutorial above for getting Google Analytics code, from Step 2 we are explaining how to add it using Google Tag Manager.

      Reply

  20. Barry Alexander
    May 17, 2021 @ 11:35

    Please clerify that; can I add both codes
    1: Google Analytics code
    2: Google Tag Manager
    in my WordPress theme via plugin as well ?

    Reply

  21. ramtin
    Jul 27, 2022 @ 10:18

    Hello

    Do you have detailed instructions like these for Google Analytics 4?

    Many thanks.

    Reply

Reply