Google Analytics is a web service platform that collects and tracks data from your website. Google Analytics also provides for SEO optimisation and performance-based insights, and analytical tools for marketing purposes.

One of the major reasons why your marketing campaigns succeed is the availability of visitor insights to track their behaviors and patterns on your website. Google Analytics is one such tool that has the capability to provide you with accurate visitor insights and help you manage your online marketing campaigns to gain and convert visitors. Learn about easy ways to set up your Google Analytics by following a simple process with this article.

How to Add Google Analytics to WordPress

Adding Google Analytics Using a Plugin

Plugins are the best option for adding Google Analytics to your WordPress site as it is a fairly easy process and a convenient setup time.

1. Create a Google Analytics Account:

  • Create Your Account: Go to the Google Analytics website and make an account using any of your Google IDs.
  • Set Up Your Property: Once you’re signed in, you must look for the ‘Admin’ option and then select ‘Create Property’. Enter your website’s details and follow further prompts to create a new property.
  • Get Tracking ID: After setting up your property, you will get a tracker ID (UA-XXXXXXXXX-X). Keep this ID saved with you as you will need it in the later steps.
Also Read: The Non-Tech Savvy Guide to Setting Up a WordPress Website

2.  Install any WordPress Plugin

  • Site Kit is a free plugin that requires little manual effort to install, making it a good option for Google Analytics. Other plugins that can be installed easily are MonsterInsights, Analytify, and GA Google Analytics.
  • Installation: Open your WordPress dashboard and look for Plugins > Add New, and look for the plugin you wish to install. Hit ‘Install Now’ and then ‘Activate’.

3.  Configure the Plugin:

  • Connect to Google Analytics: Once you open your plugin settings, you can enter your tracking ID in order to connect your Google Analytics account, or simply follow the authentication process for the same.
  • Fine Tune Settings: You can go ahead and personalise the plugin’s functionality according to your needs, such as using anonymous IP addresses or simply optimising eCommerce.
Pro Tip: Keep your plugins functional and glitch-free by updating them timely.

Manually Adding Google Analytics to Your WordPress Theme

Manually adding Google Analytics can be tiring, and you might not be able to enjoy the extra features that plugins provide. However, this hands-on approach allows you to use Google Analytics without plugins.

1.  Sign in to Google Analytics and obtain your tracking ID.

2.  Add Tracking Code to Your Theme:

  • Theme Editor: Log in to your WordPress account, open the dashboard, and select Appearance > Theme Editor.
  • Edit Header File: Once you are in the theme editor, look for the ‘header.php’ file and select it. Be very careful while editing this file, as any error can crash your site easily.
  • Insert Tracking Code: Copy the Google Analytics tracking code that was given with your tracking ID, and paste it just before the closing </head> tag in the ‘header.php’ file.
Pro Tip: If you change your theme or update it, you will need to re-add the tracking code. Just use a child theme to avoid this issue.

Using Google Tag Manager

Google Tag Manager is a very useful tool for managing marketing tags on your website without directly modifying the code.

1.  Setting up Google Tag Manager:

  • Create Your Google Tag Manager account by using any of your Google Ids.
  • Set up a container: Follow the instructions to set up a container for your WordPress site.
  • Look out for the Container Code: As soon as you create the container, you will get two snippets of code, mainly, the head section code and the body section code.
Also Read: Connect a Domain to Your WordPress Hosting Website

2.   Add Container Code to WordPress:

  • Access Your Theme Editor: You must log in to your WordPress and open dashboard to navigate to Appearance > Theme Editor.
  • Edit Header and Footer Files: Locate the ‘header.php’ file and edit it by placing the first snippet of code just before the closing </head> tag. In a similar way, add the second snippet to the  ‘footer.php’ file just before the closing </body> tag.
  • Save Changes: Select the ‘Update File’ option to save your changes.

3.  Set Up Google Analytics in Tag Manager

  • Creating a New Tag: In your Google Tag Manager account, select the ‘Tags’ section and then go ahead selecting ‘New’.
  • Choosing a Tag Type: Choose ‘Google Analytics: Universal Analytics’ as the tag type.
  • Configure Tag: After you enter your tracking ID, you can configure it according to your preferences.
  • Publish Container: You can select ‘Submit’ and then ‘Publish’ to deploy the container and activate Google Analytics.

Wrapping Up

Learning how to add Google Analytics to WordPress is fairly easy and can help you more in establishing an online presence for your business. WordPress makes Google Analytics very easy to install and integrate to understand website traffic better.

Take your website to maximum optimisation by adding Google Analytics to your WordPress site today. For more resources and tools to support your journey, visit Crazy Domains.

Book with Crazy Domains today!