How To Add Google Analytics To GeneratePress

Disclosure: This page may contain affiliate links. When you click an affiliate link and make a purchase, we get a small compensation at no cost to you. See our Privacy Policy and Disclaimer for more info.

In this article you will learn how to add Google Analytics to GeneratePress.

GeneratePress is a multipurpose and responsive WordPress theme. It is a lightweight WordPress theme built with a focus on speed and usability. 

In most of the WordPress themes adding Google Analytics tracking code is much easier to add.

You may add the tracking code by going to Appearance >> Customize under WordPress Dashboard. Then, under HomePage setting you may get an option to add this code.

But if you are using GeneratePress WordPress theme for your blog you may find adding Google Analytics tracking code a bit tricky as the option to add it is not straight forward.

Though it is super easy to add the tracking code using plugins but I would advise you not to use it. Because the more plugin you use in your blog or website the more heavier your site becomes.

Also Read: Optimize your Blog with proper Off-Page SEO and On-Page SEO

As there are many free plugins available in WordPress and also are very easy to use, users are tempted to use as much plugins as possible even for works which could be implemented by just modifying some codes.

So, it is recommended to use as much less plugin as possible to make your blog faster to load.

Let's see how we can easily add the tracking code in GeneratePress theme.

How To Add Google Analytics Tracking Code to GeneratePress

What is Google Analytics? Google Analytics is a web analytics service offered by Google that tracks and reports website traffic. It provides real-time statistics and analysis of user interaction with the website. You can get data like your users location, behavior, source of traffic, bounce rate, etc.

To see these data, you first need to add your website to Google Analytics website and get tracking code. The tracking code is a snippet of JavaScript that collects and sends data to Analytics from a website where tracking code is added.

To add the tracking code to GeneratePress go to WordPress Dashboard and select Appearance >> Elements. Under Elements select Add New.

Then from Choose Element Type select Hook. Now enter headline of your Hook as Google Analytics Tracking Code or any other headline as you may wish.

Below the headline enter the tracking code. see the image below.

How To Add Google Analytics To GeneratePress

Now click Display Rules. See the above image. Under Display Rules select the Location as Entire Site. Keep the other settings as it is.

display rules hook generatepress theme

That's it. Now hit Publish button.


You can get the tracking code by visiting analytics.google.com. Here, you select Admin >> Property >> Tracking Info >> Tracking Code.

tracking code

I hope now you get an idea on how to add Google Analytics to GeneratePress WordPress theme.

Share via
Copy link