How To Add Google Analytics To GeneratePress

In this post I will show you how to add Google analytics to GeneratePress. You don’t need any plugin to add the Google analytics tracking code to GeneratePress.

If you have decided to use WordPress to host your site, you must check out GeneratePress theme once. GeneratePress is a free WordPress theme which is responsive, light weight, customizable and well coded.

The GeneratePress theme is free to download from WordPress site. If you buy the premium plugin (also called GP Premium plugin), you get access to all the modules which adds lots of features and functions.

If you are a GeneratePress premium user and wondering where to add the Google Analytics code, the below steps will help you.

Most of all you don’t need to install any plugin to add the analytics code to GeneratePress. The less plugins that you install, the faster your site will be.

As per Google, “The Analytics tracking code is a snippet of JavaScript that collects and sends data to Analytics from a website”.

There are two ways to add the Analytics tracking code :-

  • Directly add the code to the HTML of each page on your site.
  • Use a tag management system such as Google Tag Manager.

I believe adding the code to HTML of each page seems to be much easier. This is because you add it once and you don’t need any third-party plugin to get the job done.

How to Add Google Analytics To GeneratePress

To add Google Analytics Tracking code to GeneratePress :-

  • On the WordPress dashboard, click Appearance > Elements.
  • On the Elements section, Click Add New.

How To Add Google Analytics To GeneratePress

You must choose an element type here. Select Hook.

Choose element Type

Type the name of the hook. In my case it is Google Analytics Tracking Code.

Next you need to get the tracking code. You can grab it from Google Analytics > Admin > Property > Tracking Info > Tracking Code.

Copy the Google analytics tracking code and paste it in the box under the title.

Now at the bottom, select Settings. Choose the Hook to be stored in wp_head.

Insert google analytics code

Now click Display Rules. Select the Location as Entire Site. Now click Publish. If you are using a caching plugin, do not forget to clear the cache.

How To Add Google Analytics To GeneratePress

As a last step, let’s verify if the above steps. Login to Google Analytics, and in the sidebar, click on Real Time, then Overview. You should see the total number of visitors on your site. I hope this post helps.


Hi, I am Pragati. As a Technical Consultant, I help businesses harness the latest innovations in Cloud applications, Intune, Windows 365, and more. Sharing my knowledge and insights through this blog to inspire and empower others in their digital transformation. Let's revolutionize the way we work and thrive in the cloud era together!
Back to top button