Installing Google Analytics is the easiest way to track the visitors to your website. With the help of this free service by Google, you can monitor your website traffic, user behaviour, conversions and view a host of data like page views, sessions, traffic source, bounce rates and much more. Using this information, you can perform A/B split tests, decrease bounce rates, increase page views and optimise your website any way you want.
You may install Google Analytics on your WordPress website using the following simple steps:
1. Sign up for Google Analytics
To register for Analytics, you will need to visit https://analytics.google.com/ and sign up. If you already have a Google account, you can use it to complete the signup process, otherwise, you must create a Google account first. You will have to fill in all the necessary information such as account name, website name and URL, time-zone, country, and so on.
2. Add Tracking Code
Click on the ‘Get Tracking ID’ button, and after agreeing to the company’s terms and conditions, you will get your Google Analytics tracking code or snippet. You will need to copy and insert this code into your WordPress website to install Google Analytics on your site. This tracking code can be installed in two main ways.
i. Using a plugin
This method is recommended for people who don’t want to fidget with any codes and want a safe and straightforward way to install Google Analytics on their website. Formerly known as ‘Yoast Google Analytics’ this plugin by ‘MonsterInsights’ is available in both free and paid version. Here are the steps you can follow to install the plugin.
- Download the MonsterInsights plugin from their website, upload and install it on your site and then activate it.
- Go to Insights » Settings on the menu and click on the ‘Authenticate with your Google account’ button. Select your Google account and allow the necessary permissions to MonsterInsights plugin.
- The final step is to select your website and click on the ‘Complete Authentication’ button. You can view your data by going to Insights » Reports after a few hours.
ii. Inserting the code directly into your WordPress theme
This method can be a bit tricky for people with no prior coding experience, but there are two ways it can be done:
- Edit the header.php file of your WordPress theme. Copy your Google Analytics tracking code and paste it right after the tag in the header.php file.
- Edit your functions.php file; this will add the code to all the pages of WordPress website. Copy and paste your Google Analytics code before < ?php } ?> tag and you are done.
Be sure to save all changes after editing your theme for them to take effect.
3. Visit your Google Analytics Dashboard
Once done, you can visit your Google Analytics dashboard and click on the ‘reporting tab’ to view the data gathered by the Google Analytics tracking code. Viola!