How to Install Google Analytics in WordPress

2019-04-13 0 Comments Views

How to Install Google Analytics in WordPress

There are a few different ways to setup Google Analytics in WordPress. We will show you three methods where the first option is the easiest and the last being the hardest.

You can choose the one that best suits your needs.

1.Insert Headers and Footers Plugin

This method is not as not as good as MonsterInsights because you will not be able to do advanced tracking configuration, and you will not be able to view Google Analytics data in your WordPress dashboard.

First, you need to install and activate the Insert Headers and Footers plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Insert Headers and Footerspage. Here you need to paste the Google Analytics code that you copied in step 4 into the headers section.

Adding Google Analytics tracking code using Insert Headers and Footers plugin

Don’t forget to click on the save changes button to store your settings.

That’s all, you have successfully installed Google Analytics on your site.

2. Install Google Analytics in WordPress Theme

This method is for advanced users who are familiar with the code. It is somewhat unreliable because your code will disappear if you switch or update the theme. We almost never recommend using this method.

If this is your first time adding code to your WordPress files, then you should check out our guide on how to copy paste code snippets in WordPress.

Add code in header.php file

Simply edit the header.php file in your WordPress theme and paste the code you copied in step 4 right after the <body> tag.

Don’t forget to save your changes and upload the file back to your server.

Add via Functions File

You can also add Google Analytics tracking code to WordPress functions file. It will then automatically add the tracking code to every page on your WordPress site.

You will need to add this code to your theme’s functions.php file.

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

Viewing Reports on Google Analytics Website

Google Analytics is capable of showing you a treasure of data collected from your stats. You can view this data by visiting your Google Analytics dashboard.

Google Analytics reporting

You will see the built-in Google Analytics reports in the left column. Each section is divided into different tabs and clicking on a tab will expand it to show more options.

      • Real-time This report will show you a real time view of your traffic.
      • Audience tab will show reports to help you understand your users.
      • Acquisition reports explore where your users came from.
      • Behavior reports summarize what your users do after they arrive on your site.
      • Conversion reports show how well you’re doing against your goals.

Making the Most out of Google Analytics

Google Analytics is an incredibly powerful tool with tons of awesome features. Some of them are quite obvious and easy to use, others require some additional setup.

Here are some of the resources that will help you make the most out of Google Analytics reports.

      • Track user engagement in WordPress with Google Analytics
      • Track WooCommerce customers in Google Analytics
      • Track outbound links in WordPress

Google Analytics works best with Google Search Console (formerly Google Webmaster Tools). It allows you to see how your website is doing in search results. See our complete Google Search Console guide to learn how to use it to grow your website.

Related Posts

Maoge

My Wechat: dongyangyemao Email: dongyangyemao#qq.com

Article Comments(0)