Knowledge Base
MilesWeb / WordPress FAQ

How to add Google Analytics to WordPress with and without using plugin?

Approx. read time : 3 min

This article guides you on how to add Google Analytics to your WordPress in two different ways.

Why add Google Analytics to WordPress?

Google Analytics provides you with very detailed statistics about your website and the traffic coming to it. But, to use Google Analytics with a WordPress or any other site, first, you need to sign-up for a Google Analytics account at http://www.google.com/analytics and get a unique Tracking ID.

Once you set up the Google Analytics account and get the Tracking ID for your site, you can easily configure WordPress to it. You can do this, in two ways :

(i) By using a WordPress plugin.

(ii) By editing the WordPress theme.

Method 1: Adding Google Analytics to WordPress using plugin :

There are various plugins available that enable you to configure Google Analytics for a WordPress site, and they all function in one and the same ways. You just need to specify your Tracking ID, and the plugin will work as required.
Some of the popular Google Analytics plugins for WordPress are :

Google Analytics for WordPressGoogle Analyticator

Google Analytics

Method 2: Adding Google Analytics to WordPress by editing the theme :

Plugins seem to be convenient, but they carry processing overhead with them that may affect the site performance. If you don’t use a plugin then you can edit the WordPress theme directly to enable Google Analytics.

# Perform the following steps to enable Google Analytics by editing the theme :

1. Log in to your Google Analytics account.

2. Click on Admin, again click on Tracking Info, and then click on Tracking Code. Now copy the entire text in the tracking code box, including the starting <script> tag and the ending </script> tag.

3. Now, login to WordPress as an administrator.

4. Under the Dashboard, click on Appearance, and then on Editor. The Edit Themes page gets appear.

5. Go to Templates and under it click Header (header.php).

6. Identify the ending </head> tag. Just above this </head> tag, paste the Tracking ID code snippet from Google Analytics that you have got from Step 1.

Ensure that you include the starting <script> tag and the ending </script> tag.

7. Click on the Update File. Google Analytics will now be enabled for all pages on your WordPress site.

It may take up to 24 hours for Google Analytics to change its status from Tracking Not Installed to Receiving Data.

Also Read :

1) Steps to Disable WordPress Plugins Without Accessing the WP – Admin

2) How to disable all WordPress plugins directly from the database?

With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.

Trusted By Thousands of Clients & Big Businesses

We highly appreciate the kind and stellar feedback we receive from our customers. Delivering the best is our goal! MilesWeb is rated Excellent out of 5 based on reviews. Read more reviews.

Excellent
Based on reviews
2 hours ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
4 hours ago
Milesweb is superb Hosting pro...
Milesweb is superb Hosting provider ever, their Support team is amazing!!!...
Abhishek Singh
15 hours ago
Great support in great timing...
We need urgent assistance on changes in a primary domain on our client's Cpanel accounts and reached...
Riyaju Deen
21 hours ago
Best Website Hosting platform ...
I was new on MilesWeb. And needed help on multiple areas from setting up to getting started with cre...
Harshada
1 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
1 days ago
the team is very supportive th...
the team is very supportive though at times effort needs to be made to make understand the problem s...
Suree Sharma
1 days ago
I am using miles web for 3plus...
I am using miles web for 3plus years, very quick and perfect support by the team, they helped me man...
Sri Raghav
2 days ago
The service is good...
The service is good. They are answering with patience and doing the needful as soon as possible....
MR
2 days ago
Perfect and Valuable Server + ...
I am using MilesWeb Servers, The main thing which I getting are continuous support over everything w...
Gunjan Makwana
3 days ago
Very quick and helpful assista...
Very quick and helpful assistance. Support person listened properly and provided a nice solution....
Narendra
4 days ago
positively helped me with find...
positively helped me with finding insecure content on my website causing SSL to not work properly on...
Thaviraj Junglee
4 days ago
Exceptional support, Truly Pra...
I had opted for the basic wordpress hosting plan as I intended to experiment with various plug-ins. ...
Aseem Chandna