Add Google Analytics to WordPress

Digital marketing Blog SEO Analytics

Google Analytics is among the most popular web analytics tools. It is a free service from Google that collects website traffic data to analyze advertising campaigns. As a result, the business receives objective, detailed information about what customers like and what they do not. Using metrics, a company can improve its marketing strategies.

According to statistics from the builtwith platform, 28,832,505 active websites worldwide use Google Analytics. We analyzed the 12,536,702 most visited sites that actively use analytics tools. The top platforms with the highest traffic in the United States include:


Pay attention to the feedback from representatives of different organizations who used the tool:

“Google Analytics is the headliner and unrivaled mega-tool for all digital marketers and professionals. The data it gives is pretty accurate from my experience.” – Abhinav Ranganath P, Senior SEO Analyst.

“Real-time monitoring service and region control help us understand motivation and attract wealthy customers. In addition, dashboards can be customized in 75 ways with advanced filtering options.” – Arunima R, Software Engineer.

“After a short training course, you can easily create useful reports that improve the productivity of your site. Things are going up.” – Ankit K, Head of Marketing and Communications, CommVersion.

“Observing guests’ heavy use of the website can greatly improve the quality of service and provide concrete, informed knowledge of what areas are of interest to everyone and what is not meeting the wishes of users.” – Kyson S, PR Marketer.

“I am glad that the number of page views is available, there is a gradation by country. Events in the application, activity by week, and important reports in the analytics service.” – Jyotirmaya P, Application Development Analyst

“I find this tool is intuitive and uncomplicated to set up. Everything is in line with the needs of the niche. Linking your AdSense account to Google Analytics is extremely easy.” – Rachid F, Financial Management Advisor.

“By far the best part is that this powerful analysis tool doesn’t require me to spend every month.” – Ettore R, eCommerce business owner.

“Over the years of improvements, Google Analytics has matured, smarter, more user-friendly and updated the old-school UX. You can set conversion goals and track multiple funnels.” – Info B, Expert Web Marketing and Social Media Consultant.

How does Google Analytics work, and what are its benefits for businesses of all sizes? This article contains answers to these questions and step-by-step integration instructions for WordPress sites.

Why is it important to add Google Analytics to WordPress?

The goal of any website is to attract as much quality traffic as possible and increase sales. Google Analytics helps meet these challenges. The platform’s tools meticulously collect the maximum amount of data about user behavior on the site.

Google Analytics processes multidirectional information:

  • Who visits the site – audience segmentation by geolocation, device and browser type, screen resolution, JavaScript, selected display language, etc.
  • Typical user behavior patterns – which page they go to, how long they stay, and bounce rate.
  • The data helps track conversions and store revenue.
  • When they visit the site – determines the prime time for publications and mailings, the time zone of the target audience, etc.
  • Where users come from – search engines, social networks, direct links, referrals, other sites, etc.
  • How users interact with content – informative for analyzing landing pages.

Information is the basis for building content that is useful for the buyer.

Key point: Analysis shows which strategies are not working and which ones are worth focusing on.

With Plerdy tools, you can understand Google Analytics better.

Plerdy has developed marketing tools that complement Google Analytics and work more clearly in some aspects of the analysis. Plerdy collects click data and analyzes user behavior. Extensions help to identify weak points of the site, optimize it, and increase conversion.

eCommerce: sales performance from Plerdy vs. Google Analytics

The Plerdy team compared the performance of Google Analytics eCommerce and Plerdy Sales Performance. As a result, 10 purchases were made from different devices, browsers, and for different amounts.

Google Analytics missed 2 out of 10 transactions and did not record the behavioral characteristics of real customers. The missed data was not further reflected in the final reports. Lost figures accounted for 20% of sales. In monetary terms: $88,314.

The Plerdy Sales Performance tool provided complete sales information. In the final report, customer data was segmented by the type of device they purchased. Calculated conversion rate, average order amount, and total revenue for the test period.

The Google Analytics test showed that conversion rates and average order values ​​had been overestimated. If this happened in real business analytics, the results would lead to the wrong conclusions and marketing strategies.

Read more about the Plerdy vs. Google Analytics test results

Plerdy event tracking and migration to Google Analytics

The Event and Goal Tracking extension tracks certain user activity on the website. You need to set up specific events where the site visitor will interact with visual content, forms, and other website elements.

Similar analytics tools only count page views. However, by recording user behavior on on-site pages, a marketer or analyst receives detailed data for analysis.

Features available in the tool include:

  • Tracking macro and micro events
  • Prioritization of events
  • Data aggregation
  • Automatic summation
  • Convenient statistics

You can study the data yourself or activate new events to Google Analytics with just one click. The platform will carry out advanced data analysis without interfering with the site’s HTML and additional settings.

Plerdy plugin with WordPress

The service is fully adapted for WordPress sites. The extension contains a site heatmap, session records, pop-up forms, NPS forms, SEO validation, and more.

Installing the Plerdy plugin only takes a few minutes:

  1. First, go to the link and install or upload the files to your server.
  2. Log in to your Plerdy account and copy your tracking script.
  3. Go to the Plerdy Heatmap tab in the admin menu on the left.
  4. Paste the tracking script into the script field and click Save Changes.

The collection of information will start automatically as soon as the tracking code is added to the site.

Step-by-step instructions on how to install the tracking code on your website can be found in this video.

Here’s what the qualified marketers and analysts who tested the Plerdy tool have to say:

“Plerdy has a set of options for deep diving into serious interface analysis. The tool will help eradicate old problems and find the reasons why users do not reach certain points of your site.” – Alexandro L, pharmacist

“Setting up an extension takes no more than five minutes – once, and you’re done. I love the fact that they often update their software.” – Matt W, President of a company

“Provides immediate SEO validation and beautiful visual heatmaps.” – Juan David G, Digital Strategy and Online Platform Development Specialist

“So far, I’ve used the user session recording feature the most, and the layout makes it easy to see how users interact with the site. Indicators for cursor movement, page scrolling, click and keyboard input allow you to quickly and easily scan videos to see the main parts of long posts.” – John B, Founder and CEO

“After a few minutes of contact with the platform, everything starts to make sense. A step-by-step guide allows anyone to customize the system fully and analyze metrics.” – Abdul Sattar G, Senior Web Designer and Front-End Developer

“Plerdy’s video conferencing feature has helped the clients we work with.” – Mohammed Faizan Ahmed S, Marketing Strategy Coach

“Plerdy offers a more complete analysis than most of the equivalent products I have tested. I especially prefer to use the SEO and UX analysis tools.” – Andréas H, Web Developer

“We were thinking about scaling MGMZIN and decided to use Plerdy to see how we can leverage e-commerce capabilities. Already at the initial stage, we made many changes that raised the conversion. We were surprised to see and understand where users face challenges.” – Cristian T, Executive Art Director

“Heatmaps with handy filters on the right side of the screen provide insight into which organic traffic is being clicked on and which specific traffic with a UTM source is easy to visualize.” – Mark P, Internet Strategist

Manually Add Google Analytics to WordPress with code.

You need to install the tracking code. We have compiled detailed instructions below.

Step 1: Sign up to Google

Create a Google account or sign in to an existing one.

To register a new user, you must fill in the fields:

  • First and last name
  • Username, which will subsequently be displayed as the name of the mail in the format [email protected]
  • Password

To enter your account, you need to enter your email and password.

Step 2: Sign up to Google Analytics

By clicking the “Install for free” button, go to Google Analytics:

  • If several people use the account, indicate this in the parameters.
  • In the box below, mark what data the system will collect for analysis.
  • Next, create a resource: enter the data about the analyzed site, and select the time zone and currency for reporting.
  • At the bottom of the box, activate the Universal Analytics (UA) item in the additional parameters.
  • Enter the URL of the website.
  • Select Create Google Analytics 4 and Universal Analytics Assets or Create Only Universal Analytics Resource. The second option will allow you to use other tracking platforms and accurately measure the effectiveness of your ads.
  • Enter information about the company: industry and size of the business, and how you will use Google Analytics (study customer interaction with the site, optimize the site or application, etc.).
  • Click Create.

Please read and agree to the Google Analytics Terms of Service and the GDPR Data Processing Terms. Confirmation of the account creation will appear on the screen. The user will receive a unique ID and a piece of tracking code. In the future, it will be used to integrate the site with Google Analytics.

Manually, such a code can be obtained in the administrator menu in the bottom-left corner. The identifier in the UA-XXX format and the global site tag is indicated here. Save them.

Next, add the Google Analytics 4 resource – it’s even easier here:

  1. Go to the admin section of the current resource.
  2. Find Admin in the bottom-left corner.
  3. In the Property column, select the first option: Setup Assistant Google Analytics 4.

The system will direct you to the home screen.

Step 3: Open the file header.php

You can add Google Analytics tracking code to your topic header file.

Go to the “Appearance” menu on your WordPress dashboard, and then go to the “Theme Editor” section. Further:

  • Open the header.php file in the right column of the screen.
  • Paste the code snippet above the tag.
  • Click the Update File.

Add Google Analytics to WordPress with Plugin

Google Analytics can be connected to a WordPress site in three ways:

  1. Add it without a plugin.
  2. Create a Google Analytics Plugin for WordPress.
  3. Add it using one of the existing plugins.

The easiest way is to use a plugin. You don’t need any special knowledge – here’s a simple guide to integrating Google Analytics using the official WordPress plugin from Google Site Kit.

Most of the comments about the plugin are positive. Here are some of them:

  • “The mission of the plugin is to combine all the main functions of Google SEO in one place; this synergy makes it much easier to monitor Google statistics and makes it easier to optimize your website’s SEO.” – Doug Nix
  • “A really useful plugin. Briefly, but in detail and to the point. If you are interested inadequate site statistics, then this is what you need.”– Robert Chalmers
  • “Great plugin and very friendly and responsive support.” – dfsdkjbhf983789hjckd
  • “This plugin saves my time with analytics, Search Console, and AdSense.” – Edsbali
  • “It does a lot more than just showing analytics.” – Peecao
  • “The Site Kit is a really powerful tool for getting an idea of ​​how visitors interact with my website and knowing what they are looking for. Useful because it shows me what’s trending now.” – Loldoll62
  • “Premium features – no fees, no tariffs, and no subscription. Integrates well with Analytics and Search Console.” – Bebbe81

Step 1: Install the plugin

Log in to your WordPress site and make sure it is up and running. Then, from the navigation menu on the left, select the Plugins tab:

  1. Click Add.
  2. Enter Site Kit in the search bar.
  3. Install and activate the plugin.
  4. Connect Site Kit to your Google account.

Does the site have multiple admins? To gain access, each of them must connect their account.

Step 2: Configure plugin

The tools available include:

  1. Google Search Console – collecting data about how many people saw the site in search results and what query they used.
  2. Adsense – automatic placement of advertisements on the site and tracking its performance.
  3. PageSpeed ​​Insights – the effectiveness of your pages in comparison with peers and useful tips to improve performance.
  4. Tag Manager – tag management through a single manager.
  5. Optimize – tuning optimization and A/B testing.

The Site Kit also works on sites with a secure staging environment and a production site to install and activate the helper plugin.

After installation:

  1. Go to Developer Settings.
  2. Fill in the live site URL in the Custom Site URL field and add the client ID and client secret for the custom GCP application. If there is no such application, click Create Credentials on the developer settings page.

When transferring a test version of a site to a working version, you must remove the additional plugin and reset the Site Kit settings. Then re-configure the plugin and add the necessary Google tools.

Add Google Analytics to WordPress with Google Tag Manager

Google Tag Manager helps you manage your tracking tags.

Step 1: Sign up to Google Tag Manager

For a new user, enter the:

  • Company name
  • Country
  • Name of the container – a container collects tags, triggers, variables, and related configurations set on a website or mobile app.
  • Target platform – sites and optimizations for mobile devices, iOS or Android applications to use Accelerate Mobile Pages.

The tag server setup menu appears on the screen. There are two ways to add a server for Google Cloud Platform:

  1. Automatically following the recommendations of the system
  2. Manually

In the first case, the default settings will correspond to the platform’s permanent free plan. After that, however, the provider warns that costs are possible. In addition, there is an extended paid version: Tag Manager 360.

Go to Accounts and select Create container. Then fill out the same form and accept the platform terms.

The container must be installed:

  • In Tag Manager, go to the Workspace section.
  • At the top of the window, find the container ID in GTM format: XXXXXX.
  • Click on the identifier – the “Install Tag Manager” window will open.
  • Copy and paste the code snippets to your website as instructed in the Install Tag Manager field.

You can also download and install ready-made mobile software development kits (SDKs). The tool’s instruction manual describes installing on a web page, AMP page, or smartphone app.

Step 2: Google Tag Manager settings

If the container is installed correctly, proceed to set up the tags. Give it a name, choose a type, and start setting it up:

  • When choosing a type, click on Google Analytics: Universal Analytics.
  • Select New Variable from the drop-down menu.
  • Name the variable.
  • Enter your Google Analytics Tracking ID.
  • Save the settings.

The next step:

  • Click on the icon in the center of the screen that says “Select a trigger for this tag to fire.”
  • For a basic Google Analytics implementation, select All Pages.
  • Next, select Tags from the left sidebar, check the box next to the Google Analytics tag, and click Apply.

Google Analytics is now integrated with Google Tag Manager. As a result, the customized tag will be executed on every page.

Step 3: Add Google Tag Manager in WordPress

The Google Tag Manager plugin must be downloaded from the WordPress Plugin Repository. Next, activate it in the corresponding menu item.

After activating the plugin, go to your site’s dashboard:

  1. From the options menu, select Insert Headers and Footers.
  2. Then paste it into the Header Scripts field.
  3. Copy the other code from your account and paste it into the “Scripts in the footer” field. The section will print scripts before the closing tag.
  4. Save your changes.

The button is available in the upper-right corner. An orange banner will indicate that the user is working in preview mode. The code won’t run until you click Publish.


With Google Analytics, all the secrets become clear: the business gains access to information about their work on the Internet and audience reactions. Such data helps to assess the attitude of consumers towards a product. It is common practice to use analytics to replace or improve the marketing strategies of WordPress websites.

Plerdy’s analytical tools are no less useful for business. Their functions expand the scope of research.

Andrew Chornyy - 001
Article by:
CEO Andrew Chornyy

CEO Plerdy — expert in SEO&CRO with over 11 years of experience.

Leave a reply for "Add Google Analytics to WordPress"

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