---
title: "How to Google Analytics to WordPress Without a Plugin"
description: "Google Analytics is one of the most powerful tools you can add to your toolbox for tracking your website activity. It is the most widely used tool and it's free for the basic features. If you're..."
url: https://www.inmotionhosting.com/support/edu/wordpress/install-google-analytics-wp-no-plugin/
date: 2017-10-21
modified: 2026-01-22
author: "InMotion Hosting Contributor"
categories: ["Web Analytics", "WordPress Tutorials"]
type: post
lang: en
---

# How to Google Analytics to WordPress Without a Plugin

Google Analytics is one of the most powerful tools you can add to your toolbox for tracking your website activity. It is the most widely used tool and it’s free for the basic features. If you’re using WordPress, this tool is very easy to install without a plugin. When you have added Google Analytics you will be able to track data, produce charts and reports that reflect your WordPress site’s activity.

## Steps to Add Google Analytics for WordPress without using 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.

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-1024x619.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.

### 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 saving it, then the website is ready to be tracked with Google Analytics. For more information on using Google Analytics, please see the [Google Analytics Help Center](https://support.google.com/analytics#topic=3544906).
