How To Add Google Analytics To WordPress

Deal Score0
Deal Score0

Are you trying to learn how to improve your WordPress site’s performance and target your audience more effectively? If you aren’t already using Google Analytics, it might be a good time to start. Google Analytics helps you get to know your audience better by showing you your traffic stats for free. Here is everything you need to know about Google Analytics and why it’s essential to add to your site. 

Why You Need Google Analytics For Your WordPress Site

Bloggers, e-commerce, business, and hobby websites alike can all benefit from getting more traffic and subscribers. By installing Google Analytics, you’ll get more insight into your website traffic, including: 

    • Your Audience shows you a plethora of knowledge about your visitors, including the geographical, age, gender, and more
    • Behavior – shows you how long people stay on your site, what the bounce rate is, and what type of content they interact with


  • Real-time data – shows you information about the most popular time and date for visitors to come to your site and even how many people are on your site at any given moment
  • How people find your WordPress website – shows you which marketing methods are more effective for you
  • Conversion – you can see how effective you are at achieving your website goals for your visitors (i.e., gain new subscribers, convert more visitors to buyers, etc.) 


Sign Up With Google Analytics

Before you can add Google Analytics to your site, you need to sign up for it! It’s free to use, and all you need is a Google or Gmail account to sign up. If you don’t already have one, you simply have to create one.

Once you’ve signed up, it will create a Google Analytics tracking code that you’ll copy and paste to your WordPress site once you have installed Google Analytics on WordPress. 

Method 1: Install Google Analytics in WordPress Manually

You can manually install Google Analytics into your theme if you are a more advanced user who has experience working with code. When you update your theme, it is essential to remember to reinstall Google Analytics because it likely won’t switch over. 

To get started manually, you should always back up your WordPress files to a secure place, in case something goes wrong. Next, you will need the Google Analytics tracking code you copied from earlier. You can add this code by:


  • Add code in header.php file. Edit the WordPress theme’s header.php file and add the tracking code after the <body> tag. 
  • Add via the Functions File. With this method, simply add the tracking code to the WordPress functions file. That way, it will automatically place the tracking code on each of your WordPress pages without you having to do it manually.

    You’ll add this code to the functions.php file:



add_action(‘wp_head', ‘wpb_add_googleanalytics');

function wpb_add_googleanalytics() { ?>

// Copy and paste your Google Analytics tracking code here

<?php } ?>

You must pick just one of these two methods. By doing both, you might mess up your WordPress site. After you have effectively manually added Google Analytics to your WordPress site, make sure to back up your website once again and save it in a secure place. 

Method 2: Install Google Analytics in WordPress With A Plugin 

If you aren’t as technically savvy and don’t want to mess with the coding of your website, you can use a plugin to do the trick for you. 

Google Analytics for WordPress by MonsterInsights

This plugin is especially popular because it’s easy to use. The first step is to install the plugin. Go to Plugins > Add New, search for the plugin by name: Google Analytics for WordPress by MonsterInsights, and install it. 

Once the plugin has been installed, you’ll see Insights in the dashboard. Select Settings and then Authenticate with your Google account to connect your site with Google Analytics. 

That’s it!

Google Analytics Dashboard for WP by ExactMetrics (formerly GADWP) 

This is another plugin that is easy to use, doesn’t require you to know a line of code, and gives you insight into the traffic passing through your website. 

Once again, the first step to using this plugin is to install it! Go to Plugins > Add New, search for the plugin by name: Google Analytics Dashboard for WP by ExactMetrics, and then install it.

The plugin is customizable based on what type of website you might have: Business website, publisher (blog), or eCommerce. Once you have made your selections, it will give you more personalized settings to better track your site’s performance. 

Next, connect your Google Analytics account to the plugin. Once you’ve done so, the plugin will take care of the tracking for you. 

Check the Reports  

Once you have added Google Analytics to your WordPress site via either method, make sure that you check the reports and see who is visiting your site. If you use a plugin, it will pull the Google Analytics data right into your WordPress dashboard. Or, you can choose to look directly in your Google Analytics account. 

Google Analytics and WordPress 

Once you figure out who is visiting your site, what content they are interested in, or even if they are bouncing right off your page, you can start to reconfigure your website to make it better than ever. Google Analytics can give you invaluable information to better reach your target audience and accomplish your goals. 

Regardless of which method you choose, both are effective ways to add a tracking code to your site and start building your site more efficiently. 

We will be happy to hear your thoughts

Leave a reply

10 Best Hosting Website
Login/Register access is temporary disabled