If you want to have a successful site, it is essential to know your audience and what they expect from their website. The best way to achieve this is by analyzing your traffic. That’s exactly what Google Analytics does. This Google’s free software allows you to track visitors to your site, analyze their habits, traffic sources, social metrics and different statistics and more. Analyzing statistics, you can plan and create better content for your readers. This tutorial will show you how to sign up and add Google Analytics to your site WordPress .
Things are very easy when you know what your users want from you, your site and its services, are not they? The only way to make your visitors spend time on your site and come back again is by providing what they need. That’s exactly what Google Analytics is free! Here are some reasons why we suggest you to add Google Analytics to WordPress and see why each WordPress blog must have it:
Although there are some other web analytics services that you can use, Google Analytics provides a variety of unique features. Let’s take a quick look at each of them:
These are just some of the many features of Google Analytics that make the whole process of handling a WordPress site easily!
You may already think that Google Analytics is amazing. But how does it do this? Well, we understand that having a basic knowledge of how the software works helps you make the most out of it. Broadly speaking, Google Analytics is:
That’s how it works. It may seem an easy process at first, but a lot of features and processing is going on behind the scene.
We hope that this certainly reinforced the decision to add Google Analytics to your WordPress site. No more beating around the bush, here’s a quick tutorial that will show you how to sign up and add Google Analytics to your site WordPress .
Content
Before beginning this guide, you need the following:
The first thing you need to do is create a Google Analytics account and get the tracking code. The steps below show how to sign up for Google Analytics:
Fill in all required details and press the button Get Tracking ID ( 6 ). On the next page, you will be prompted to accept the Terms of Service, then click on Accept .
That’s it! You created a Google Analytics account successfully. On the next page, you will see the universal tracking code Google Analytics:
<Script> (Function (i, s, a, g, r, a, m) {i [ 'GoogleAnalyticsObject'] = r; i [r] = i [r] || function () { (I [r] .q i = [r] .q || []) push (arguments)} i [r] .l * 1 = new Date ();. A = s.createElement (o) s.getElementsByTagName = m (o) [0]; a.async = 1; g = a.src; m.parentNode.insertBefore (a, m) }) (Window, document, 'script', 'https: //www.google-analytics.com/analytics.js','ga'); ga ( 'create', 'UA-00000000-1', 'self'); ga ( 'send', 'pageview'); </ Script>
This JavaScript code is identical for all sites. Only the tracking ID ( UA-00000000-1 ) is unique. You should see your on the same page. The tracking ID begins with UA , which means Universal Analytics, the first set of numbers is the account number ( 00000000 ) and the last number is the Google Analytics ID ( 1 ).
There is more than one way to add the Google Analytics tracking code to WordPress: Using a Plugin, adding the tracking script directly to the file header.php or creating something new in the file functions.php .
If you are not familiar with the structure of WordPress and PHP files, it is recommended to use the Plugin method. One of the best plugins for this is Google Analytics Code Integration . This plugin will automatically insert the tracking code for Universal Analytics – you only need to enter your tracking ID.
The steps below show how to install the plugin and insert your Google Analytics tracking ID:
4. That is, the tracking code has been successfully added to your WordPress blog.
Note that it may take 12-24 hours for the Google Analytics upgrade and begin to show the first results. Later, statistics on your target audience will be provided on the tab Reports Analytics.
As we said, there are some ways to insert the Google Analytics code into a WordPress blog. For example, the code can be included in the file header.php of your theme:
Note: Google Analytics code is inserted only on your active theme. You will need to add it back if you change the subject.
This method requires some basic knowledge of coding and we recommend that you follow only when you are confident in what you ‘re doing. Moreover, it is highly recommended to create a backup file functions.php or even the entire WordPress installation before continuing:
add_action ( 'wp_head' 'my_analytics', 20); my_analytics function () { ?> <Script> (Function (i, s, a, g, r, a, m) {i [ 'GoogleAnalyticsObject'] = r; i [r] = i [r] || function () { (I [r] .q i = [r] .q || []) push (arguments)} i [r] .l * 1 = new Date ();. A = s.createElement (o) s.getElementsByTagName = m (o) [0]; a.async = 1; g = a.src; m.parentNode.insertBefore (a, m) }) (Window, document, 'script', 'https: //www.google-analytics.com/analytics.js','ga'); ga ( 'create', 'UA-00000000-1', 'self'); ga ( 'send', 'pageview'); </ Script> <? Php }
Note: The code will be inserted only in your active theme. If you change your theme, you will have to re-add the code again.
Needless to say how much Google Analytics is essential to your WordPress site in order to better understand your audience. After completing this tutorial, you learned how to create a Google Analytics account and three different ways to add Google Analytics to your WordPress blog. Check out our tutorials to stay on top of all matters relating to the world of technology and hosting sites .