How To Add Google Analytics to WordPress

  • 5 min read
  • by

Introduction

If you’re trying to increase the traffic on your WordPress site, you can’t ignore analytics. Among other things, you will need this data to know more about your site’s visitors, which pages they frequently visit and when they visit. Thankfully, there is a free and easy to use service available that can help you out with this – Google Analytics. The service collects data from Life Cycle, Users and even Events so you can track down which ever data you need.

In this tutorial, we will show how to setup a Google Analytics account and how to integrate it with your WordPress site.

Signing Up and Configuring Google Analytics

To be able to use Google Analytics on our WordPress site you first need to sign up for a Google Account. Once that is done. Proceed to the Google Analytics dashboard.

Once there, click on the Admin link in the dashboard.

Once in the Admin page, click on Create Account button.

Enter an Account Name.

Then click on Next

We then have to setup a property, which represents the WordPress site’s data. We have to give it a name. Click Next afterward

Set up your business information, then click Create. Accept the Terms and Conditions after.

Once that is done, you will be redirected to the Data Streams page. Click on Web to setup a web-based stream.

Enter the URL of your WordPress site in the URL text field then give it an appropriate name. Click Create Stream

This will open the Web stream details window for the WordPress site. Take note of the code in the Global Site Tag. You will need to place embedded this code snippet on your WordPress site.

Adding Google Analytics to Your WordPress Site

Using the Insert Headers and Footers Plugin

Once you’ve setup the Google Analytics account, you will be able to use Google analytics to track the data on your WordPress Site.

The easiest way to do to this is to use the Insert Headers and Footers plugin, which can be found in the Add Plugins page. Install and activate the plugin.

Once that is done. You just need to paste the script from the Global Site Tag in the Web stream details from your site in the Scripts in Header box in the Insert Headers and Footers page and clicking Save.

After doing that, your WordPress site, should be tracked by Google Analytics.

Using the Google Analytics Dashboard Plugin

Another alternative is to use the Google Analytics Dashboard Plugin. Which can also be found in the Add Plugins page in the Admin Dashboard.

Once, you’ve installed and activated the plugin, you’ll be redirected to the admin dashboard, and you’ll see a “Welcome to MonsterInsights” page. Scroll down and click on Launch Wizard

In the setup wizard, you will be asked to connect your Google Analytics account to MonsterInsights. Once you get to the page below, click on Connect MonsterInsights

Allow MonsterInsight to access

From there, proceed to the rest of the setup. When the setup is finished, your WordPress site should be tracked by Google Analytics.

Editing the header.php File

The last way, you can add Google Analytics to your WordPress Site is through modifying header.php file of your theme. This can be edited through the Theme Editor page in the WordPress Admin dashboard.

To do edit the header.php file look for the Theme Functions link on the right hand sidebar of the Theme Editor page.

Place the code found in your Global Site Tag inside the <head> tag of the header.php file. Click on Update File after.

After doing this, Google Analytics should now be tracking your website.

Conclusion

That’s the end our tutorial. We’ve learned how to setup Google Analytics and integrate it with a WordPress site.

Kristin Eitel

Leave a Reply

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