How To Add Google Analytics To GeneratePress

| | March 21, 2024

Are you facing trouble in adding tracking code of Google Analytics to GeneratePress powered website? Don't worry, you're covered in this article.

Google Analytics is the most popular free website analytics software in the world. It is used by bloggers, marketers and business owners to get useful insight on their website traffic.

Once you installed the tracking code providing by Google Analytics on your website, it starts providing key website metrics such as the number of visitors, bounce rate, location, time on site, page views and others.

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

If you're using GeneratePress theme on your website but don't how to add Google Analytics tracking code, this article will help you to learn how to add it.

Let's get started.

Note: This article contains 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.

Adding Google Analytics in GeneratePress Websites?

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.


If you have already added your website in Google Analytics, you can get the tracking code by visiting

Log in to Google Analytics and 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.

Photo of author

Deepak Choudhary

Deepak Choudhary is the founder of He is a Blogger and an Affiliate Marketing Expert. He publishes useful articles for newbie bloggers related to the following topics - Affiliate Marketing, Email Marketing, Software Reviews, Software Tutorials, Blogging, WordPress, SEO, Passive Income, and more.