Steps to Install Google Analytics in WordPress

This question may have come to your mind, why to install Google Analytics on your WordPress website / blog? The answer is Google Analytics is a free web analytics service provided by Google that offers insight and information about the website traffic.

Now let us see how to install Google Analytics in WordPress. #

Step  1. Create a Google Analytics account

You need to first create an account with Google Analytics by accessing the “Google Analytics Signup Page” using your Gmail account. In case you do not have an account on Gmail then you must create one.

Step  2. Signup for Google Analytics

After you sign in using your Gmail account, you will be instructed to sign up for Google Analytics.

You have to click the “Sign up” button

Step  3. Fill the information

Once you have clicked the “Sign up” button you will see the screen which requires your inputs. You need select options and enter the appropriate information.

What would you like to track?

Do you want to use Google Analytics to track your website or your mobile app?
Select the website option


Setting up your account

Below this option you need to fill the required information like

Account name
Website name
Website URL
Industry Category
Reporting Time Zone

After you have filled in the appropriate information click “Get Tracking ID”
The terms and service will be displayed on screen scroll below to read.
To proceed further click “I Accept”

Step  4. Website tracking code

After you click on “I Accept” a tracking code will be generated.
You have to copy this code which you need to enter it over your WordPress website.

Keep the analytics browser tab open since you will have to reopen it after you have installed on your WordPress site the tracking code.

Step  5. Install Google Analytics in WordPress

Google Analytics can be installed by 3 ways on WordPress.

1. Direct Paste Method.
The tracking code which you have copied must be pasted in the theme’s header.php just after the  <body> tag.

2. Functions.php Method.
Make a note that this method may be used if you are aware of the basic semantics of PHP.

In the themes’ function.php add the below code and paste the Tracking code (Google Analytics code)

1 <?php
2 add_action('wp_footer', 'add_googleanalytics'); 
3 function add_googleanalytics() { ?>
4 // Paste your Google Analytics code here
5 < ?php } ?>

3.  Plugins Method.
To add Google Analytics to your website, there are many plugins available. It is better to use a plugin that is simple and light-weight something similar to the plugin Insert Header and Footer. In the plugins’ setting page, paste the Tracking code.

Step  6. Code installed on the Website

After you have installed the Analytics code on your Website go to the browser tab where the Analytics is still open and click Save.

It can take around 12 to 24 hours for Google to start providing site statistics.

If you have any queries then feel free to ask our team.

Powered by BetterDocs