8.2 C
New York
Tuesday, October 4, 2022
Eduma Premium Education WordPress Theme

How to add Google Analytics to WordPress?

If you want to know well about your audiences and how they interact with your WordPress site, you need to check traffic stats. And at this point, you might think that using a WordPress Google Analytics plugin can solve this matter. However, there are 3 more useful methods/ways for you to add a Google Analytics to WordPress site. Let’s check with us what and how to do it!

Google Analytics Introduction

If you are a blogger or owner of a website, you definitely want your WordPress website to get more traffic and subscribers. Hence, Google Analytics is probably a perfect platform to help you monitor your site’s activities and show detailed stats. Adding Google Analytics to WordPress is a big help to improve your site traffic to track your visitors’ behavior.

wordpress google analytics default

To clarify, you should use a code snippet then insert it into each site page header. With Google Analytics, you can track a lot of useful information. There are 5 categories:

Realtime: It displays all the activities happening on your site at the time you are checking the report.

Audience: It describes a group of visitors who have similar actions on demographics and behavior.  

Acquisition: To identify how your visitors find your website, from organic search or from direct URL, from website referrals or social networks, and from others.

Behavior: It reports on individual pages and gives data of pageviews, data of unique pageviews, the estimated average time on each page, the data of bounce rate, plus, the percentage of exit. 

Conversions: Are activities that are completed by users, these conversions contribute to your business success. There are goals, E-commerce, and Multi-channel funnels attribution.

Below is some examples that you can see while using Google Analytics:

– How many active users are on your site at the time you check

– The total users visit your site over time

– You can check your visitor’s genders, languages, ages, and locations

– How your visitors/ readers arrive at your website, for example, from organic search or social networks

– Which page visitors are using and how much time they are speeding on that page

– Track the bounce rate, click-through, and conversion rates

Those examples are the highlight data you should notify. However, there is still much information on your Google Analytics dashboard you can check to improve your site and increase your business. Overall, it’s important to have a WordPress Google Analytics in your site.

Why is Google Analytics Important to Your WordPress Site?

Google Analytics can bring a lot of benefits to any kind of site you are using. Let’s check out the most value areas if your site has WordPress Google Analytics:

Content marketing plan: You can know which post, which page, which content, or which product that your visitors usually visit. So you can create more content to increase the pageviews and traffic.

Inbound marketing: Google Analytics can provide where the traffic from so you can determine your marketing strategies and focus on how to increase more results

Read more:  5 Digital Marketing Tips and Tricks from Top Brands

Audience segmentation: To increase more conversions, you should deeply understand your audience. A good way when using Google Analytics is to build some subgroups for intended marketing

UX auditing: Google Analytics helps to display user behavior. Then you can know the issues with your navigation or website layout design. Plus, you can know which poor contents and which high bounce rate pages are to improve them.

In particular, for eCommerce websites, you can track your sales as well as your revenue through conversion reports. 

Together with those useful features of Google Analytics, it’s more valuable if you know how to apply your understanding from it to your site. So why don’t you install Google Analytics on WordPress site?

Four Useful Ways to Add Google Analytics to WordPress

In this part, we are going to introduce you to 4 possible methods you can pick to add Google Analytics to WordPress site. 

Firstly, you should create an account in Google Analytics in case you don’t have it. It’s easy to sign up like other platforms in a few steps. Now is the time to explore the details of 4 methods.

Use a WordPress Google Analytics Plugin

Using a WordPress Google Analytics plugin is the easiest or simplest way to have this platform on your site. In particular, it does not require any code to install and set up. There are some famous plugins like Site Kid by Google or GA Google Analytics that you can download freely on WordPress.org. 

GA Google Analytics

ga google analytics

In this article, we will guide you how to add Google Analytics to WordPress with GA Google Analytics plugin. It is a free, fast, and famous plugin with over 600 thousand active installs on the official WordPress site. Plus, the plugin has dozens of powerful features like tracking code customizable, Gutenberg block editor compatible, including tracking code on all web pages, etc.

Firstly, you “Download” GA Google Analytics on WordPress.org then “Add New” plugin in WordPress dashboard admin. Then you click on the “Install” button then ” Active” button to have this plugin on your website. The next step is adding your Google Analytics tracking ID in its settings.

Now you need to open your Google Analytics website with your account and click “Admin” right on the sidebar.

google analytics admin tap

Then click at “Property” -> choose “Tracking info” -> select “Tracking code

google analytics property tap

You can see the “Tracking ID” which starts with UA letters and next is numbers and copies this tracking ID.

google analytics access tracking id

Go to the WordPress dashboard panel, hover to “GA Google Analytics” -> choose “Plugin settings” -> Paste to “GA Tracking ID” and set up “Force SSL” and “Tracking Code Location“.

ga google analytics settings

You can choose to place the tracking code on the header vs footer, enable/ disable tracking of admin-level users, disable/ enable page tracking in the Admin Area, etc.

Once you have done with your settings then click on the “Save Changes” button. That’s all, now your WordPress website has a Google Analytics plugin. 

Manually Connect Google Analytics and WordPress with Code

Here is the second way to have WordPress Google Analytics in your site. Thanks to  functions.php file, you can use it to add that Google Analytics tracking code into your WP theme. 

Read more:  How to Change Password in Your WordPress Site (2022)

Moreover, this method requires you to use a child theme to avoid any error while updating your WP theme. Plus, making a backup is a good way if you are going to make changes. 

Now you need to activate your stunning child theme then find Google Tracking code to paste right ahead the closing place </head> tag in the Theme Header, which is at the (header.php) part.

Similar to the first method, you should access your Google Analytics website by your account, click “Admin” -> select “Property” -> select “Tracking Info” -> and choose the “Tracking Code“. At this step, you copy the script in “Global Site Tag” (you can refer to the picture below).

google site tag code

Then you go back to your WordPress admin panel site, click “Appearance” -> select “Theme Editor“. If you can not see header.php, you can hover to “Theme Files” then click on the parent theme name. 

wordpress theme editor

You will see the header.php and now paste the script right before the </head> tag in the editing page.

edit header template

After that, click “Update File” to complete. Finally, your site has Google Analytics Code WordPress.

Integrate Google Analytics and WordPress with Google Tag Manager

The third method to have Google Analytics into WordPress is using the famous platform – Google Tag Manager. If your website not only analyze but also incorporates scripts for a lot of purposes, this method can bring useful help.

Some of you might wonder what a Google Tag Manager is? It is actually a tag management system. Plus, it is a perfect solution to update tags and code snippets  in your WordPress website or on mobile apps with ease. You don’t need to edit the side code in your WordPress dashboard, you just need to update the scripts from its user interface. This way helps to reduce any issues while configuring tags.

So how to setup Google Analytics on WordPress? The simplest way is using Google Tag Manager (GTM) WordPress plugin, which you can download easily and freely on WordPress.org. This GTM comes with over 500 thousand active installs and hundred stars. Plus, GTM mainly focuses on managing & deploying analytics and marketing tags. Also, it offers code snippets and supports multiple containers too.  

After downloading this Google Tag Manager tool, you can go to your WordPress admin dashboard panel -> hover to “Plugins” on the sidebar -> click “Add New” -> then “Install” and “Active“. Now you go to Google Tag Manager website, sign up an account then start creating your container. 

Once you complete the first container, on Google Tag Manager dashboard, you click “Admin” and look for a container ID which starts with the big letters GTM and next is numbers then copy it.

find container id wordpress google analytics

Now you go back to your WordPress admin panel dashboard, click on “Settings” -> Select “Google Tag Manager” and you can see the plugin’s settings page. On “General” tap -> Paste “Google Tag Manager ID” and set up “Container code placement“.

google tag manager for wordpress

Remember to click “Save Changes” and now you have completed setting up Google Analytics on WordPress site.

Syncing Google Analytics Locally for Performance Reasons

The 4th  way to have WordPress Google Analytics site is syncing the Analytics script locally in your own server. 

Read more:  How to Embed Youtube video in WordPress

If you receive the request about reducing your external HTTP, you now do not need to worry since this syncing Google Analytics can help you easily and quickly. Plus, you can totally control the file caching so it’s easy to use your own server’s caching headers. These are just some benefits if you use this method in WordPress and Google Analytics.

Moreover, if you are using Google PageSpeed Insights, you probably have seen a notification error “Serve static assets with an efficient cache policy”. This is a warning when you use Google Analytics script.

pagespeed insights analytics

It helps you know and improve your site performance. And you can see the cache time is about 2 hours on Google Analytics warning. It’s easy to understand since Google needs to check things on its end, so it requires all users who have the access to the changes as quick as possible. Overall, changing the cache time is the way to improve your site performance, thanks to Google Analytics script hosting on your own server.

Syncing Google Analytics Locally with the Complete Analytics Optimization Suite

To begin, you should download the CAOS – Host Google Analytics Locally plugin on WordPress.org. It’s a free and famous plugin by Daan from FFW.Press with over 20 thousands active installs. Moreover, CAOS has various amazing features, like host analytic.js (Google Analytics JavaScript file) or gtag.js locally, minimal Analytic ready, Google Analytics V4 API support, anonymize the IP address of visitors, etc. 

Like the above steps, you can download and activate the CAOS plugin easily on your WordPress admin panel. 

caos

Another note that, you need to deactivate other analytics plugins if you installed before to use CAOS. Next, on your WordPress admin panel, click on the “Settings” on sidebar -> select “Optimize Analytics” and “Basic Settings” tap -> Paste your “Google Analytics Tracking ID” -> Choose “Footer” option in “Position of tracking-code” -> Then “Save Changes“. 

caos host google analytics locally settings

Furthermore, this CAOS plugin helps to add necessary code for Google Analytics to your WP site. After that, CAOS plugin will download and save the analytics.js file to your own server. Beside, it will keep on updating via a scheduled script in wp_con(). Always take note that this plugin doesn’t work with any other Google Analytics plugins.

Syncing Google Analytics Locally With Perfmatters

Another way of syncing the Google Analytics locally is using the Permatters plugin. It’s one of the lightweight performance and famous plugins you should try. However, Perfmatters is not a free plugin, it’s a premium plugin. Apart from its powerful features such as CDN rewrite, script manager, database optimization, etc, it has a feature to sync Google Analytics locally. Similarly, you just copy and paste the Analytics tracking ID then set “Tracking Code Position” is “Footer” with “Script Type” is analytic.js (Default).

perfmatters

Final Thoughts

Google Analytics is the most powerful tool you should use to analyze your visitor’s activity. Even if it is not the only one tool available, it’s the perfect solution. It helps you have data to gain more audience as well as brand. Hopefully, you can apply those instructions above and add successfully the WordPress Google Analytics website.

Read More: 10 Best WordPress Cache Plugins for 2021

Related Articles

Eduma Premium Education WordPress Theme

Latest Articles