How to Add Google Analytics to WordPress Blog

Google Analytics is a free web analytics software service offered by Google. It helps you to track and monitor your blog traffic accurately.

It also provides the details of who visits your blog, what they do on your blog, how much time users spend on your blog, how they interact with your content and much more. You can use these data to improve your blog.

You can add Google Analytics (GA) to WordPress blog in 3 easy ways. Choose the method you prefer. Let’s check it out all the methods.

Add Google Analytics to WordPress

Method #1

Adding GA Code to the Header

I highly recommend you to take a backup of the header file before making any changes.

In Google Analytics, copy the code. You can find it by going to Admin section > Tracking info [under property column] > tracking code.

Log into your WordPress dashboard.

Go to Appearance > Editor > header.php.

Now, paste the code above </head> tag or after the opening <body> tag.

add google analytics to header.php

Update the file.

That’s it. You’ve successfully added GA (Google Analytics) code to WordPress.

Method #2

Adding GA Code to Theme

This method is very simple. You can add GA code in your theme if your theme supports (see screenshot).

Adding Google Analytics code to wordpress via theme inbuilt feature

Just add the code and save the changes. Now, GA should be installed.

Method #3

WordPress Plugins

There are many WordPress plugins are available to add Google Analytics code. I recommend you to go with any of these plugins.

Insert Headers and Footers

Google Analytics by Yoast

If you need help with installing plugins, check out our plugin installation guide.

Final Thoughts

I recommend you to go with the method 2. If your theme doesn’t support, then go with method 3.

After you install Google Analytics in WordPress, go to Google Analytics and make sure that everything is working correctly. It takes Google up to 12-24 hours to give status updates for your blog.

Also see:

How to Exclude Internal Traffic from Google Analytics

How to Clone Widget on WordPress

Scroll to Top