How to add Google Analytics to WordPress?

Google Analytics is one of the most advanced free website traffic tracking software. When you create a GA account and generate the tracking code for your site, you must add this tracking code to your WP website else you won’t be able to see what are the most popular pages on your website, how much time a page takes to load in the browser, from which countries do your site gets most traffic and more. Why use Google Analytics? If you study the reports GA shows, you can discover the drawbacks of your website, improve the revenue, keep your site safe, etc.

There are two ways to add GA tracking code to a WordPress site and to be honest both methods are easy. Let’s have a look at both methods:

Inserting GA code without a plugin

WordPress themes let users insert JavaScript code in the header or footer region of the website without making them edit any page. If the theme ships with an options/settings panel/page, you can find the option to add GA code to the WP site on this page. You should copy/paste your Google Analytics tracking code into the large textbox in the theme settings interface and click the save button to save the theme settings. Many WP themes add customization options to WP live customizer tool (WP admin > Appearance > Customize). If your template doesn’t come with a settings page, open the WordPress live customizer tool and find the setting that lets users insert JS code. Once you find this option, paste your GA tracking code in the textbox and click the save option.

Use the best WordPress Google Analytics plugin for WordPress

The WordPress repository has 50+ GA plugins. Here is the list of best WP GA extensions among the lot:

Site Kit by Google: This plugin by Google can not only insert GA code in the pages of your website but also allows you to track the site’s search performance, AdSense revenue, etc. To use it, you must sign in to your Google account with this extension and configure its options as per your requirements. Google Site Kit has 1+ million users.

Monster Insights: Monster Insights ships with a nice settings wizard and allows you to see the GA data in the WP dashboard. Monster Insights comes with a popular posts widget. This widget shows the site’s most popular post, according to Google Analytics data.

Analytify: This plugin not only shows GA tracking data in the WP dashboard but also comes with advanced options such as – anonymize IP addresses, track demographics & interests, 404 errors, and more.

Conclusion: Google Analytics is one of the most useful tools for website owners. Despite being free software, it gives you access to many reports of your website. If you own a WP site, you can install GA on your website by following the steps or by using a plugin that we’ve covered above.


Pramod is the founder of wptls. He has been using WordPress for more than nine years. He builds web applications, and writes about his experiences with various WP products on this site.

Leave a Reply

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