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.
Add Google Analytics To GeneratePress
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. The less plugins that you install, the faster your site will be.
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.
To add Google Analytics Tracking code to GeneratePress :-
- On the WordPress dashboard, click Appearance > Elements.
- On the Elements section, Click Add New.
You must choose an element type here. Select Hook.
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.
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.
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.