In this tutorial you will learn how to add google Analytics to WordPress ( Only for Self-hosted WordPress Websites ).
If you have a website, it is obvious that you want to know about your visitors and where they came from ? The best way to track them is through Statistics and this is what Google Analytics actually does. It helps you to track your visitors and their other activities.
Importance of Analytics :
Analytics is must for every blogger and website owner, It allows you track :
Visitor’s location and device they use
You can get the geographical location of your visitors and which browser they used to visit your site. Analytics will also tell you about the device (Desktop or Mobile) your visitors use to reach you which helps you to know about your desktop and mobile traffic.
You can track What your visitors do when they visit your website and the time they stay on your website.
How they came to know about your site
This is very important to know how your visitors came to know about your site or page. They came from Search Engine, from any social networking sites ( Facebook, Twitter and more ), direct links or from any other site.
Every blogger wants to know about their Audience and for this Google Analytics seems a right option. Everything that you want to know about your visitors you could know, once you start using Google Analytics account.
Some of the main Features :
- Collection & Configuration APIs : It helps you to collect data and manage your account in custom. Let you know how users interact with your content and more..
- Event tracking.
- User Permissions.
- Data Import : Import All your data in one place.
- Product Integrations.
- Reporting : Audience Reporting , Benchmarking Reports, Custom Reporting, Performance Reporting, Ecommerce Reporting, Conversion Reporting and more..
- Alerts & Intelligence : If any significant statistical variations, then you get alerts.
- And many more ….
Before you do anything, The very first and essential step is to Create Google Analytics Account.
How to Signup with Google Analytics
Step – 1 :
To do this, Click on the Sign Up button to create a new account.
If you already have a gmail account then you can simply use that to Sign In. And if you do not have one then you will have to create a new account to get started. Add Google Analytics to WordPress – Easy guide for beginners.
Step – 2 :
Now you will see Sign Up page, Where you will see a new Sign Up button on which you have to click.
Step – 3 :
After clicking on the Sign Up button, You will see a new page where you will be asked to choose between Website and Mobile App.
You will choose Website, by default Website is selected but make sure once that the Website is actually selected.
Now fill the required details properly.
Step – 4 :
After filling the information, scroll down and click on the blue button – Get tracking code. Now read the terms and conditions and then click on the I Agree button.
Step – 5 :
Here you will get your tracking code. Now Copy the tracking code and visit to your site and paste the code. ( Where ? Scroll down and see the methods.)
How to insert the tracking code in WordPress to get started with Google Analytics
You can paste the tracking code in your theme’s header.php immediately after the opening of <body> tag.
3. PHP Implementation
I won’t recommend this method to the beginners. This method isn’t safe and if you really know about this method and you are friendly with the functions.php file then only use this method.
( Source : Google )
- Use the code above to create a file named “analyticstracking.php”, and include the file on each PHP template page.
- Add the following line to each template page immediately after the opening <body> tag:
<?php include_once(“analyticstracking.php”) ?>
Some themes do have a Separate option for Google Analytics tracking code. Better check your theme option and make sure whether you have any such option in your theme for Analytics tracking code or not ? If it’s there then go with that and if not then you can use any above method.
How to Find your tracking code, tracking ID, and property number from existing Analytics Account.
If you have an analytic account and you want to find tracking code, tracking ID, or property number then follow the steps given below :
- Sign in to your Google Analytics account
- Click on the Admin tab.
- Select your Property and select your Account too from the dropdown in the Property and Account section.
- Now under the property, click on the Tracking info.
- To tracking code click Tracking Info > Tracking Code.
If you are not using Google Analytics yet, This might be the right time when you start using Google Analytics to track your site’s traffic. Add Google Analytics to WordPress.
Liked this Article ? If Yes then please do not forget to share it with your friends on Facebook or Twitter. If you have any question then you know that we are here for you, ask you are questions in the comments.
Add Google Analytics to WordPress Full Video