---
title: "How to Add Google Analytics to WordPress"
description: "Google Analytics is one of the most used website statistics applications on the internet. You can easily find Google Analytics specific plugins that make it easy for you to integrate the application..."
url: https://www.inmotionhosting.com/support/edu/wordpress/how-to-add-google-analytics-to-wordpress/
date: 2020-11-03
modified: 2026-01-22
author: "InMotion Hosting Contributor"
categories: ["WordPress Tutorials"]
type: post
lang: en
---

# How to Add Google Analytics to WordPress

![](https://www.inmotionhosting.com/support/wp-content/uploads/2020/11/ga-header-img-1024x538.jpg)

Google Analytics is one of the most used website statistics applications on the internet. You can easily find Google Analytics specific plugins that make it easy for you to integrate the application into your WordPress website. There is also the option to add Google Analytics directly to your WordPress site without using a plugin. These guides can help you make use of Google Analytics for tracking your [WordPress site statistics](https://www.inmotionhosting.com/support/edu/wordpress/how-to-install-and-set-up-hotjar-for-wordpress-hosting/).

- [Install Google Analytics to WordPress with a Plugin](#with-plugin)
- [Install Google Analytics to WordPress without a Plugin](#without-plugin)
- [How to Add the Google Analytics Tracking Code in BoldGrid](#boldgrid-tracking)

---

Want a better home for your WordPress site? Check out InMotion’s [WordPress Hosting](https://www.inmotionhosting.com/wordpress-hosting) for secure, optimized servers that are configured for your budget needs.

---

## How Do I Add Google Analytics to WordPress Using a Plugin?

WordPress provides different options to measure its performance, but Google Analytics is the most used option for checking the statistics of your website. Google Analytics can be installed without a plugin but this tutorial will demonstrate how you can install it using a Google Analytics plugin. There are many [Google Analytics plugins](https://www.inmotionhosting.com/support/edu/wordpress/connecting-with-google-analytics-in-jetpack/), but the one used in this tutorial will be the [Google Analytics Dashboard for WP](https://wordpress.org/plugins/google-analytics-dashboard-for-wp/). It provides you access to the Google Analytics data without having to leave the WordPress Administrator interface.

## Installing the Plugin for Google Analytics – Google Analytics Dashboard for WP

1. [Log into the WordPress Administrator](/support/edu/wordpress/logging-into-wordpress-dashboard/)
2. [![Click on plugins](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-plugins-menu.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-plugins-menu.png)Click on **Plugins**.  
3. [![Click on Add New](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-plugins-add-new.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-plugins-add-new.png)Click on **Add New**.  
4. [![Search for Google Analytics dashboard plugin](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_find-google-analytics-plugin.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_find-google-analytics-plugin.png)Search for the plugin that we will be using in this tutorial – **Google Analytics Dashboard for WP**.  
5. [![Select install now](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-install.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-install.png)When you see the plugin option appear, click on the **Install Now**.  
6. [![Activate plugin](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-activate.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-activate.png)Click on **Activate**.  

### How to Authorize the Plugin to connect to Google Analytics

Once the plugin has been installed, the next part is to authorize the plugin to connect to Google Analytics.

1. If you are not [logged in to the WordPress Administrator, log in](https://www.inmotionhosting.com/support/edu/wordpress/logging-into-wordpress-dashboard/).
2. [![Google Analytics in menu](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-configuration-page.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-configuration-page.png)With the plugin installed, you will see the option for **Google Analytics** on the menu. Click on **Google Analytics**.  
3. [![Click on Authroize plugin](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-authorize.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-authorize.png)You will be brought to the Google Analytics Settings page. Click on **Authorize Plugin** in order to start the plugin authorization process.  
4. [![Click on Get access code link](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-get-access-code-link.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-get-access-code-link.png)You will see the Google Analytics Settings page. You will see a link labeled **Get Access Code**. Click on this link.  
5. [![Connect to Google Account](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-choose-account.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-choose-account.png)It will attempt to login to your Google Account. You will need to select the appropriate account.  
6. [![Click to Allow access to Analytics](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-allow-access.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-allow-access.png)Once you have selected the account there will be a window asking for you approval to allow access to Google Analytics. Click on the **Allow** button to proceed.  
7. [![Copy Access Code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-authorization-code.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-authorization-code.png)Copy the code that you see next.  
8. [![Paste Access Code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-add-access-code.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-add-access-code.png)Go back to your WordPress site and paste the code into the **Access Code** field.  
9. [![Save Access code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-save-access-code.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-save-access-code.png)Click on **Save Access Code**.  
10. [![Select website to track and make settings changes if needed](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-authorized.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-authorized.png)You will then be brought to the **General Settings** page. Select the account that you wish to track if you have multiple accounts. Make any settings changes if need.  
11. [![Save changes](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-save-changes.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-plugin-save-changes.png)Click on **Save Changes**.  

That completes the plugin authorization. You will need to add the tracking code to your website in order for Google Analytics to track your website activity. Follow the steps below to add the tracking code.

## Adding the Google Analytics Tracking Code to your WordPress Website without a Plugin

Google Analytics requires that you add code to your theme files. As with any change made to your site, it is highly recommended that you perform a full backup of the site so that you can recover should anything unexpected happen during the installation process.

### Obtain the Google Tracking code

1. [Login to Google Analytics](https://support.google.com/analytics/answer/1009692?hl=en)
2. [![Click on Admin icon](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-admin-icon.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-admin-icon.png)In the menu at left scroll down until you see the gear icon that is used for the **Admin **section. Click on this section.  
3. [![Select website to be tracked](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-choose-website.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-choose-website.png)Select the property (website) that you wish to track by clicking on the drop-down menu under the property section.  
4. [![Click on Tracking Info section](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-tracking-info-1.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-tracking-info-1.png)Under the column, you will see an option labeled Tracking Info. Click on **Tracking Info**.  
5. [![Click on Tracking Code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-tracking-info-2.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-tracking-info-2.png)This will bring up another set of options. Click on the one labeled Tracking Code.  
6. [![Copy code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-tracking-code.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_ga-tracking-code.png)A column of text will appear on the right with your *Tracking ID*, *Status,* and then a *Website Tracking* section. You will see a window with the **Global Site Tag** (*gtag.js*) Copy this text and then go to your WordPress site.  

### Apply the Google Tracking Code into the WordPress theme’s header

1. [Log into the WordPress Administrator](/support/edu/wordpress/logging-into-wordpress-dashboard/)
2. [![Click on Appearance](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-theme-editor.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-theme-editor.png)Click on **Appearance** and then click on **Editor**.  
3. [![Find header.php](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-select-header-php-file.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-select-header-php-file.png)A typical WordPress theme will have a **Theme Header (header.php)**. Find this file in the list at the right, then click on the file link. It will open the file in the editor. *If you have a theme where the file doesn’t seem to have a header.php file, then contact the theme’s developer for assistance.*  
4. [![Paste tracking code and save](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-theme-code-added.png)](/support/wp-content/uploads/2017/10/wp-ga-plugin_wp-theme-code-added.png)Paste the Global Site Tag (gtag.js) code that you copied earlier into the **header.php** file above the “</head&rt” tag in the header.php file.  
5. Click on **Update File** in order to save the code changes.

Once you’ve finished adding the tracking code into your theme header then you be ready to start using Google Analytics with your website. Next, we will provide more information on installing Google Analytics without using a plugin.

## How to Use Google Analytics on your WordPress site without a Plugin

If you’re using WordPress, it is possible and easy to add Google Analytics to your website without using a plugin. When you have added Google Analytics to your site you will be able to track data, produce charts and reports directly from the Google Analytics application.

Google Analytics requires that you add code to your theme files. As with any change made to your site, it is highly recommended that you perform a full backup of the site so that you can recover should anything unexpected happen during the installation process.

Your first step will be to obtain the tracking code within Google Analytics. This means that you must have [created a Google Analytics account](https://support.google.com/analytics/answer/1008015?hl=en&ref_topic=3544906). Then you must have already set up[ a property (your website)](https://support.google.com/analytics/answer/1042508) so that Google Analytics will be able to track it. If you have already completed these steps, then you can begin the steps below.

### Obtain the Google Tracking code

1. [Login to Google Analytics](https://support.google.com/analytics/answer/1009692?hl=en)
2. [![Click on Admin icon](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-admin-icon.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-admin-icon.png)In the menu at left scroll down until you see the gear icon that is used for the **Admin **section. Click on this section. 
3. [![Select website to be tracked](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-choose-website.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-choose-website.png)Select the property (website) that you wish to track by clicking on the drop-down menu under the property section. 
4. [![Click on Tracking Info section](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-tracking-info-1.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-tracking-info-1.png)Under the column, you will see an option labeled Tracking Info. Click on **Tracking Info**. 
5. [![Click on Tracking Code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-tracking-info-2.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-tracking-info-2.png)This will bring up another set of options. Click on the one labeled **Tracking Code**. 
6. [![Copy code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-tracking-code.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_ga-tracking-code.png)A column of text will appear on the right with your *Tracking ID*, *Status* and then a *Website Tracking* section. You will see a window with the **Global Site tag** (*gtag.js*) Copy this text and then go to your WordPress site. 

### Apply the Google Tracking Code into the WordPress theme’s header

1. Log into the WordPress Administrator
2. [![Click on Appearance](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_wp-theme-editor.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_wp-theme-editor.png)Click on **Appearance** and then click on **Editor**. 
3. [![Find header.php](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_wp-select-header-php-file.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_wp-select-header-php-file.png)A typical WordPress theme will have a **Theme Header (header.php)**. Find this file in the list at right, then click on the file link. It will open the file in the editor. *If you have a theme where the file doesn’t seem to have a header.php file, then contact the theme’s developer for assistance.* 
4. [![Paste tracking code and save](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_wp-theme-code-added.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_wp-theme-code-added.png)Paste the Global Site Tag (gtag.js) code that you copied earlier into the **header.php** file above the “</head>” tag in the header.php file. 
5. Click on **Update File** in order to save the code changes.

When you have finished adding the tracking code to your theme header, then you’re ready to start using Google Analytics to track your website.

## BoldGrid users – how to add the Google Tracking Code to your theme’s header

The BoldGrid plugin can affect how the menus appear. Please refer to the directions below to properly add the code to the header section of your BoldGrid site.

1. [Log into the WordPress Administrator](/support/edu/wordpress/logging-into-wordpress-dashboard/).
2. [![Click on Customize](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-1.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-1.png)Click on **Customize**. 
3. [![Click on Advanced](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-2.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-2.png)Click on **Advanced**. 
4. [![Click on Header Settings](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-3.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-3.png)Click on **Header Settings**. 
5. [![Paste the tracking code](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-4.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-4.png)In the field provided under Custom Header HTML paste the **Global Site Tag (gtag.js) code**. 
6. [![Save the changes and publish](https://www.inmotionhosting.com/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-5.png)](/support/wp-content/uploads/2017/10/google-analytics-no-plugin_boldgrid-customize-5.png)Then click on **Save & Publish** button at the top of the column in order to save your changes. 

Once you have completed adding the code and saved it, then the website is ready to be tracked with Google Analytics. For more information on using Google Analytics, please see the [Getting Started with Google Analytics](https://support.google.com/analytics/answer/1008015?hl=en). For further information on the use of the Google Analytics Dashboard plugin, please see this [tutorial](https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp) or [video](https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp).
