06 Jan 2016
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 (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.
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 :
- Fill requisites: Account Name, Website Name, and the URL of website (www.example.com)
- Set Industry Category and Time Zone: Small businesses should select ‘Business and Industrial Markets’ and their local time zones (for best results)
- 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:
- Fill requisites:Account Name and Setup container (website/app URL).
- Click ‘Create’
You are brought to a screen that gives you code snippet for Google Tag Manager. Copy and paste it on a notepad.
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:
- Choose Product >> Google Analytics
- Choose a Tag Type >> Universal Analytics
- Configure Tag:
- Add Tracking ID (as gathered from Step 1.) and paste it here.
- Enable Display Advertising Features.
- Optional: Under More Settings >> E-commerce Features, users can Enable Enhanced E-commerce Features (along with Data Layer) only on Page Views.
- Click Continue.
- Fire on: All pages.
- 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.
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.
- Sign in to Google Analytics (A Google account will be all you need) to get the Universal Analytics Tracking ID.
- 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.
- 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.
- Add Google Analytics by creating and publishing a tag through Tag Manager (see Step 4. Of the Set-Up for more details).
- 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.
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.
It’s your turn to statistics into insights that help your business grow.
So what are you waiting for?
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.