By adding Google Analytics, you can track your site visitors, analyze their behaviour and see what content they like the most. Overall, with Google Analytics, you can create a stronger, more functional website that can cater to your customer journey.
Let's start the guide with setting up a Google Analytics account for your website. You can do the same process for any website.
If this is the first time, you need to go to Google Analytics Page and log in through your Google account or create a free account. Follow this easy step to sign up for Google Analytics:
Visit https://analytics.google.com; you will be redirected to the page like given below:
In the setup process, you will be asked to add your website details and your details to get started. If you do not have an account, create a new account using the link Create Account.
After you enter your account details. You get this kind of page given below. Here, you need to sign up Google Analytic by clicking the Sign Up button.
Here, you get two options, Website or Mobile App. Select Website and fill all the details like Account Name, Website Name, URL, Reporting, etc.
At the end of the page, there are settings for Data Sharing. These setting to share the data will Google are optional so, it depends on you, you want to allow or not.
Now, click on Get Tracking ID and you will get your Google Analytics tracking code or script.
Here, you can see your Google Analytics tracking code under Website Tracking, just copy this code
How to Install Google Analytics in WordPress
You can install Google Analytics in WordPress with three major methods: Direct, Plugin, and Theme Hook Content.
How to Add Google Analytics to WordPress without Plugin
Direct Method: Just paste the tracking code in the PHP file of your theme; follow the given steps to do this.
Go to Dashboard>Appearance>Editor
Select theme to edit. And open the footer.PHP by clicking it from right-hand side files list
Now, Paste the tracking code at the bottom of footer.php file, just above the tag. Now click on update and done
Paste this code to your WordPress site to link your site with your Google Analytics account. There are also multiple ways to add this code to your website. Let's go through the process to know how and where you can paste this tracking code.
Theme Hook Content Method: Some WordPress themes like Themify allow you to insert code at various locations of theme layout. The best part is that you can do without editing the original theme files. Paste tracking code through hook content-
Go to Dashboard>Theme Settings (Theme Panel) > Hook Content
Now, click Add New to add a new code box. Paste the tracking code and choose the location Wp_footer. Now click on the save button and you are done.
How to Install Google Analytics in WordPress through a Plugin
There are numerous plugins for Google Analytics. Check out the article on 10 best Stats Plugin for WordPress
Let's take Google Analytics by MosterInsights.
First of all, install and active this plugin in your WordPress and set up Google Analytics by MosterInsights-
Go to Dashboard>Install Plugins> Google Analytics by MosterInsights Settings.
Now, you need to authenticate your Google Analytics account by Google Account on which you are using Google Analytics. If you want to enter manually, you can do so through UA code.
Click saves chances and that's it
While on the next page, you need to add your website details to get the tracking code.
According to the method, you will use to put Google Analytics code to WordPress; we may be using only tracking ID or the complete script. Basically, this is what will help you to connect WordPress with Google Analytics for tracking site visitors and more.
Web analytics is vital to understanding your audience and their behaviour. The data will guide you to know the number of people visit your website, where they come and what they are up to.
And with this guide, you have learned how to install Google Analytics in WordPress in different ways, via plugin, without plugin so you can take advantage of its awesome features.
With the required data you can make your blog or website more attractive and functional for your visit and provide more value to them and ultimately grow your business.
Do you use Google Analytics? How did you select to connect it to your site? Let us know in the comment section below.