How To Add Google Analytics To WordPress

add Google Analytics

Are you looking for a way to add Google Analytics to WordPress site of yours? If you are, then this post is just for you. There are several ways to add Google analytics to your website. If you are a beginner then you may find it a bit lengthy but trust me. 

After reading this post you will be able to add Google analytics to your website all by yourself. 

Let’s begin then. 

Signup In Google Analytics

At first, you have to visit Google Analytics and register. 

Click on the ‘Set up for free’ button now provide your account name and click on the next button. 

Provide the property name, reporting time zone, and currency. 

Hit the next button. Choose the industry category, business size, and how you like to use Googe analytics for your business. 

When you click on the create button a pop-up will open with terms and conditions, choose your country and place a tick on accept box. Click on the ‘I Accept‘ button. 

Now you will be asked to choose a platform. Click on the Web platform. 

Provide your website link and name it anything you like in the Stream box then click on the Create stream button. 

Now you will be provided with the tag code. 

Add Google Analytics To WordPress Theme

This is one of the easiest methods. First copy the tag code that you got above. 

Now navigate to Appearance -> Theme File Editor. Open header.php in your WordPress theme and paste the Google Analytics tracking code right after <body> tag.

Save your changes. 

Alternate Option

If you wish you can also add Google analytics through the Functions file. Navigate to Apperance -> Theme Files Editor and open functions.php. Now add this code. 

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

Don’t forget to paste your tracking code in the above code. 

View Report

To view the report, you have to visit the Google Analytics website. From there you will be able to see any type of report you wish to view. 

If you want to view your report in your dashboard, then you may take the help of the MonsterInsights plugin. It shows you all your reports with more details directly in your dashboard. 

Last Words

That’s it. I hope you have successfully learned how to add Google Analytics to WordPress easily. If you have any questions feel free to ask and don’t forget to share your thoughts in the comments box below. 

Leave a Comment

Your email address will not be published.