WordPress is a CMS(Content Management system), and it’s one of the most popular out of all the CMS available today in the market.
But the question arises why it’s so much favored? The answer to this question lies in the fact that it’s easy and flexible to use.
Plugins in WordPress makes it unbeatable. Plugins extend the WordPress functionality, which is why many plugins are available in the WordPress community.
Today we are not going to discuss WordPress but how to add google analytics to your WordPress website.
But before diving in we would like to introduce Google analytics:
What is Google Analytics?
Google Analytics is a software developed by Google LLC, which can measure various website metrics such as page views, bounce rate, number of website visitors, and the total number of sessions.
When you are starting a website, you must add Google Analytics into your site because it’s easy to use and also available free of cost.
How to install Google Analytics into your WordPress website?
There are two ways in which you can connect Google Analytics into your website:
- Through installing Global site tag into header.php
- Use of plugins
Installing Global site tag into header.php
Header.php is a file that is included on every page of your WordPress website. The idea is simple; you have to install the tracking code on every page you want to track with google analytics.
Where to find the tracking code for Google Analytics
Head over to the Google Analytics website, i.e., analytics.google.com, and add the property that you want to track. Here the property is the domain name (e.g., in our case, we have to verify that we own https://digipromarketers.com domain)
When you confirm that you own the domain next comes installing tracking code to your website.
Head over to the admin section in Google analytics, and there you will find three parts Account, Property, and View (refer to the screenshot ).
In the property section, you have to find and click on tracking info.
When you click on tracking info you will see the following options:
- Tracking Code ( Only focus here)
- Data Collection
- Data Retention
- Session Settings
- Organic Search Sources
- Referral Exclusion List
- Search Term Exclusion List
- Now click on the first option Tracking code.
- You will see the global site tag
Global Site Tag (gtag.js)
Global Site Tag (gtag.js) is the unique tracking code for a website. Copy and paste this code between <HEAD> of every web page you want to track. Practically, if the site has a lot of pages, it’s impossible to add it to each page. This is why we prefer to add it in a file that is used on every page of a WordPress website, and in our case, it is header.php.
If you already have a Global Site Tag on your page, add the config line from the snippet mentioned below to your existing Global Site Tag.
Reference Google Analytics
<!– Global site tag (gtag.js) – Google Analytics –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X”></script>
window.dataLayer = window.dataLayer || ;
gtag(‘js’, new Date());
Please note that XXXXXXXXX-X has to be replaced with your property ID and it’s unique for every website.
Now copy the Global site tag(gtag.js) and open your WordPress website dashboard.
Go to the Appearance and click on the theme editor. If you have disabled theme editor, you can find header.php through a file manager or use any FTP client to add a Global site tag into your header.php.
Please note that you have to add gtag.js between <head></head>tags.
Use of Plugins to add Google Analytics
Now you are aware of the process by which you can install Google Analytics to your WordPress website. If you find it difficult to implement a global site tag into header.php, you can use plugins to ease the process of adding google analytics.
Here I am listing out some of the most popular and tested WordPress plugins that you can rely on while adding Google Analytics.
Site Kit by Google
As the name suggests this WordPress plugin is from google( Yes it’s developed as an open-source project under Google)
Site Kit is the official WordPress plugin developed as an open-source project by Google for website insights and to know how people find and use your website. Site Kit is the all in one solution to deploy, manage, and get website metrics from various Google tools.
It gives various website metrics from numerous Google products(Analytics, Search Console, Adsense, etc.) and that too on the WordPress dashboard for simple access, absolutely Free of cost.
What makes the Site Kit by Google plugin unique
It’s straight from open source project by Google, and in this way, it’s already unique.
- Site Kit incorporates incredible highlights that make utilizing these Google items consistent and adaptable:
- Straightforward details legitimately on your WordPress dashboard.
- Official information from various Google tools, across the WordPress dashboard
- Installation of different Google products (like analytics in our case) without editing your site’s source code.
GOOGLE TOOLS in Site Kit
Site Kit shows critical website metrics and insights from various Google products:
- Search Console: Search console is a tool by Google LLC, and it helps us to Understand how Google Search discovers and displays your pages in Google Search. Using this tool, you can track the number of people who saw your site in search results(also known as the impressions) and what query they used to search for your website.
- Analytics: With Google Analytics, you can explore how users navigate your site and track goals you’ve set up for your users to complete.
- Adsense: Google LLC also offers Adsense, and it allows you to monetize your website with Ads. With Adsense integrated into your WordPress dashboard, you can track how much your website is earning you.
- PageSpeed Insights: Again, this tool is offered by Google LLC, and it allows you to see how your pages perform compared to other real-world sites. Improve performance with actionable tips from PageSpeed Insights.
- Tag Manager: Use Site Kit to set up Tag Manager- no code editing required quickly. Then, manage your tags in Tag Manager.
- Optimize: Use Site Kit to set up Optimize- no code editing required immediately. Then, set up A/B tests to Optimize.
MonsterInsights is one of the best Google Analytics Plugin for WordPress.
Here are the features that make MonsterInsights the most powerful and user-friendly WordPress analytics plugin available in the market.
This plugin makes the installation of Google Analytics to your website easier so that you can set up global website tracking across multiple devices and campaigns and that too without inserting tracking code.
Google Analytics Dashboard
Similar to the Site kit by Google Monster Insights allow you to see vital website analytics report inside your WordPress dashboard.
One of the unique features of Monster Insights is it is able to get real-time stats right inside the WordPress dashboard to see who is online, what they are doing, and more.
Enhanced Ecommerce Tracking
Click Google Analytics Enhanced Ecommerce tracking for WooCommerce, Easy Digital Downloads & MemberPress.
Monster Insights is able to fetch detailed stats for each post and page allowing you to see the most popular posts, pages, and other crucial sections of your website.
Affiliate Link & Ads Tracking
It can automatically track clicks on your affiliate links, banner ads, and other outbound links with their link tracking feature.
EU Compliance (GDPR Friendly)
Monster Insights makes Google Analytics compliant with GDPR and other privacy regulations automatically.
Monster Insights allow you to set up tracking for authors, categories, tags, searches, custom post types, users, and other events with 1-click.
Performance & Optimize
Enable Google to Optimize for A/B testing, adjust speed & sample rate, and several other advanced features.
I hope you enjoyed reading this article. Installing analytics to your website is very crucial as it gives us insights to grow and develop our business. It doesn’t matter whether you are using Google Analytics, Jetpack Analytics, Sumome Analytics, but the point is you must install Analytics to your website. If you have any suggestions, please comment, and I will reply to each one of you.
- Site Kit от Google — Плагин для WordPress | WordPress.org …. https://ru.wordpress.org/plugins/google-site-kit/
- Use the global site tag for Google Ads conversion tracking …. https://support.google.com/google-ads/answer/7548399?hl=en
- Where to add Global Site Tag tracking code in child theme …. https://wordpress.org/support/topic/where-to-add-global-site-tag-tracking-code-in-child-theme/