Backed by Awesome Motive.
Learn more on our Seahawk Blog.

How To Add Google Analytics To Your WordPress Site?

How To Add Google Analytics To Your WordPress Site?

“If it cannot be measured, it does not exist” is a phrase that we have heard in many conferences on e-commerce and digital projects worldwide.

The importance of measuring what happens on our websites goes beyond installing a simple counter, as we did in the 90s. A vanity metric that made us happier the more the number increased.

But now everything has changed, and the counters have come to be called data. The reports of tools such as Google Analytics, Amplitude, or the alternatives Open Sources Matomo and Open Source OWA are essential to show your solvency as a digital business.

Beyond the tool, we should care about when taking data from our visitors to establish the business model we are creating, know the product funnel, set KPIs, look at the metrics that matter, and all this methodology analytics software that any startup knows and loves. We will get off the cloud and start implementing the first step of your new data policy on your website made with WordPress: install Google Analytics.

What is Google Analytics?

It is an analytical tool that tracks the clicks made by a person who visits your website. It is quantitative; it offers you numerical data on the behavior of your users.

We will know a whole series of behaviors that will surely come in handy to make decisions based on data. Here we bring you a list of the main things that you can know with Analytics:

  • How many visitors enter your website and the essential thing: from or where they access.
  •  When they enter your website, you will know which of those people who visit you are recurring and know how often they return. You can also set temporary filters, among other things.
  • Prepare personalized reports with the data that most interest you for your online project.
  • Know your sales and relate them to the other data you are collecting. With WooCommerce, the connection is direct, and, indeed, you can do it easily by following this other tutorial that we propose.

In addition, with Google Analytics 4, you will be able to do many more things that you previously needed from Google Tag Manager to configure them finely. Some of these improvements are:

  • No more double analytics Google Analytics and Firebase. If you have an application, now you can relate it to Google Analytics and have all the data unified.
  • All behaviors are treated as events; there are no page views, no custom events established by us, or anything. They are all events, and that’s it.
  • Goals disappear; now they are called conversions.
  • There is no bounce anymore; instead, you will have to create a specific metric to calculate it.
  • Users who interact with your site are now called “Active Users,” which is very much a collation of a prevalent metric of DAU, WAU, MAU, etc. (Daily Active Users, Monthly Active Users, in English).
  • You lose your data history if you previously had Google Analytics already installed. But you can keep your Universal Analytics active to keep seeing that data.
  • Add a series of events by default that before we had to add manually with Tag Manager. One of the most valuable is the internal search. Now we will know what our users are looking for on the web.

Create your first account in Google Analytics

The first step you must take is to create an account in Google Analytics if you have not done so yet. Being a Google product, you will need a Google account (Gmail).

  •  Access https://analytics.google.com/
  • Sign in with your Google account.
  • If you have access to any account, the administration panel will appear directly. If you don’t have access to any yet, it will ask you to create your first account.
  • Enter your account name.
  • Select “Web” as the measurement type.
  • Specify a name for your Google Analytics property (usually, property corresponds to a web page).
  • Enter the URL of your website.
  • Select an industry category.
  • Select the time zone in which you want your reports to be displayed.
  • Accept the data protection law and conditions of service.
  • And ready! Your first Google Analytics account has been created successfully.

The first screen that appears is the administration panel of your property (this first property is created automatically).

Property is found within Google Analytics, and it is the one that has the code and the tracking ID associated with it. Usually, one property per web page is configured. 

Add Google Analytics to your WordPress website.

After creating your account in Google Analytics, now it’s time to add the code of your property to your website. If your website is made in WordPress, you have three different options to do it:

Option A: add the Google Analytics script.

Option B: using Google Tag Manager (recommended).

Option C: using a plugin.

a) Option A: Adding the script

In this option, you will have to find the piece of JavaScript code that you own by Google Analytics and copy and paste it directly into the source code of your website so that it runs on all the pages of your website.

Although this is a custom-made website, it will be practically the only option that goes ahead that in WordPress; we do not recommend it at all.

The reason is that we are touching WordPress source code. It’s like digging into the engine of your car without mechanical knowledge. The probability that you end up loading your website is high. For this reason, we are telling it here so that you know that this path exists, but we do not delve into it.

The code we are talking about can be found in the administration panel of your Google Analytics property.

How to add the Google Analytics script in WordPress?

  • Copy the script from your Google Analytics property.
  • Access the administrator panel of your WordPress website.
  • Navigate to “Appearance – Theme Editor.”
  • In the menu on the right, select the file “header. PHP”.
  • Paste your property code right after the <head> tag.
  • Click on “Update File. “
  • Ready! You have already added Google Analytics to your website. Now it only remains to check that everything is correct.

b) Option B: Using Google Tag Manager (recommended)

Google Tag Manager is a tag manager or container that allows you to insert new tags to your website without knowing to program.

These tags are also known as “pixels” such as Google Analytics, Google Ads, Facebook, etc. In other words, they are small pieces of code that are used to send information to different tools.

For example, once you have Google Tag Manager (GTM) added to your website’s pages, if you want to add the tracking of a new Google Analytics property, you can do it all from the GTM interface without touching anything else on your Web. Or, if you need to add the Facebook Ads or Google Ads conversion tracking code or any other Google Analytics event, you can also do it from the GTM interface itself.

Create a Google Tag Manager (GTM) container and add it to your web page:

  • Create your first Google Tag Manager account and container.
  • Add the Google Analytics ‘Pageview’ tag to all pages.
  •  Add the GTM code to your web page.
  •  Preview of the container.
  • Click on the button “preview” of your container, located at the top, to the side of the button “Send.”
  •  Access your website and check that your tag is jumping correctly.
  • Publish the tag.
  • Click on “Submit” and then add a descriptive name indicating that you have added a new Google Analytics tag and click on “Publish”:

c) Option C: Using a plugin

  • Download and install the Google Analytics plugin for WordPress.
  • Navigate to “Google Analytics” in the left menu of your WordPress admin panel.
  • Click authorize the plugin.
  • Follow the steps to get an access code.
  • Copy and paste the access code.
  • Select your main Google Analytics view.
  • Click on the “Save Changes” option.
  • Ready! You have already added Google Analytics to your website.

What is the best option to add Google Analytics to your website?

They are all equally valid, but you should always check that the installation was successful.

IMPORTANT! You must use only one way to add Google Analytics to your website. Otherwise, you will be duplicate recording visits to your Google Analytics property since each of the ways it does is add the code of your Google Analytics property to your web page.

Read on to check that you’ve added everything correctly and that you don’t have your duplicate tracking code.

Check that you have correctly added Google Analytics to your website.

Once you have implemented Google Analytics to record all the page views that occur on your web page, you must make sure that everything is correctly implemented.

Just as there are different options to implement the Google Analytics tracking code, there are other ways to verify that you have done the implementation correctly and ensure that you are effectively registering the traffic on your website.

The four methods to verify if you have added Google Analytics are:

  • Reports in real-time.
  • Google Tag Assistant.
  • Google Analytics Debugger (advanced option).
  • Google Chrome console or another browser (advanced option).

a) Real-time reports

To see if you are registering visits to your Google Analytics property, you can go to one of your views in Google Analytics and open the ‘In Real Time’ report, indicating how many users are currently on your website. And, you can also see from which country they are accessing, through which source, and which pages of your website they are currently viewing.

b) Google Tag Assistant

Google Tag Assistant is an extension available in the Google Chrome browser through which you can see what tags are running on the website you are viewing (regardless of whether you have access to it or not).

After installing it, an icon will appear next to the toolbar that, after clicking, and if you are currently browsing your website, it will show you which tags are running on your website.

If you see the Google Analytics tag with your Property ID, it means that visits to your website are being recorded.

c) Google Analytics Debugger

Another Google Chrome extension that is used to verify if the tracking code of your Google Analytics property has been implemented correctly is “Google Analytics Debugger”:

After installing it, you must:

  • Open the Google Chrome console.
  • Right-click and select “Inspect Element.”
  • Select the “Console” tab.
  • Click on the button in the extension bar to activate the “GA Debug” (“ON” mode ).
  • After loading the page, you will see the information sent to Google Analytics (which property and the type of Hit).

Wrap Up

Google Analytics is a potent tool with tons of excellent features. Some are pretty obvious and easy to use, while others require more effort, including additional setup and teardown phases.

Google Analytics works very well with Google Search Console to help you measure your site’s search traffic and performance, fix issues, and make your site thrive in Google Search results.

If you want to boost your website SEO rankings and get more traffic, we’d love to connect and help you. Our dedicated team has expertise in taking your digital business to the next level!

We hope this article helped you learn how to install Google Analytics in WordPress. If you liked our article and thought it could help someone, please share it on your social media profiles. 

Related Posts

Let’s talk about WordPress maintenance services! Running a website has its own set of responsibilities

Custom fields or advanced custom fields allow you to add extra pieces of data or

With the rise in cyber threats and malware, WordPress website maintenance is crucial for maintaining

Komal Bothra May 17, 2024

23+ Best WordPress Development Agencies in India for 2024

On the hunt for the best WordPress development services in India? You need not worry

Agency WordPress
Komal Bothra May 10, 2024

How to Force HTTPS on Your WordPress Site (3 Simple Methods)

Every click, every visitor matters. Yet, a 'Not secure' warning can erode trust swiftly. With

WordPress
Komal Bothra May 7, 2024

Figma Vs WebFlow: Which is Better in 2024?

Whether you are a product designer or UI developer, both are responsible for building products

Compare Design

Get started with Seahawk

Sign up in our app to view our pricing and get discounts.