How to Add Google Analytics to WordPress

How to Add Google Analytics to WordPress

3 minutes read


Do you want to learn How to Add Google Analytics to WordPress? We have the best tutorial on the planet to do that.

In this post, we will share the value of Google Analytics and how you can effectively install Google Analytics on your WordPress website (step by step).

How to Add Google Analytics to WordPress Easily

Google Analytics is a data analytics suite allowing you to understand the traffic on the data. It’s open on over 50 million websites around the world.

The way it works is to add a piece of JavaScript code to your website (more on that below) that helps Google to monitor the actions of visitors coming to your site. These behaviors can then be compiled and viewed in the form of statistics in your Google Analytics account.

Step 1: You must first visit Google Analytics to register

How to Add Google Analytics to WordPress

Your Google account will be requested. You will use this to log whether you already have a Google or Gmail account. Alternatively, you should go ahead and set up your own Google account.

Step 2: You will be prompted to a screen like the one below after sign up for your Gmail account. You can log in with your Gmail account for Google Analytics.

How to Add Google Analytics to WordPress

After that, the name of your account will be requested. This name is used internally so that something like a corporate name can be used.

Step 3: You can select between a Web, apps, or web app and on the next screen. Click the ‘Web’ tab.

Then enter the name, the URL, the nation, and the time zone of the website.

How to Add Google Analytics to WordPress

Click on the Next button once you have entered this detail. Google Analytics terms of support are provided to you of you must agree to this, so click on the button ‘I agree.’

Step 4: Now your Google Analytics tracking code will be shown to you. You should copy the monitoring code and depend on the system you are using the following, you have to type it on the WordPress site.

How to Add Google Analytics to WordPress

You can also only keep this browser tab open and return to copy the code if appropriate.

We recommend that you open the analysis browser tab until the code is enabled in your WordPress site, as you will need to check it.

How to Add Google Analytics to WordPress

Install Google Analytics in WordPress Theme

First, when you connect to Google Analytics, you would need to copy the tracking code.

Two popular ways to apply this code to your WordPress theme files are now available. One (not both) of them can be selected.

1. Add code in header.php file

Only update the file header.php in your WordPress theme, and paste the Google Analytics tracking code after the < body > tag you copied earlier.

Don’t hesitate to save and upload your modifications to the server.

2. Add through Functions File

You can also apply a tracking code for Google Analytics to the WordPress function file. Then it applies the tracking code automatically to each page on your WordPress account.

This code must be added to the functions.php file of your theme.

<?php add_action('wp_head', 'wpb_add_googleanalytics'); function wpb_add_googleanalytics() { ?> // Paste your Google Analytics tracking code from Step 4 here <?php } ?>

That’s it, we hope you learn How to Add Google Analytics to WordPress easily. And for the visitor who asked us to write an article on How to Change WordPress Theme, we have a dedicated article on this. So, Please check the article from here.



What do you think?

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Related Articles