How to Install Google Analytics on Your WordPress Website as a Beginner?
Having a website and driving traffic is not enough if you don’t know whether the traffic is worth. And by worth we mean, whether they’re likely to convert to customers and become profitable. Therefore, you must ensure you’re targeting and driving the right traffic. Google Analytics is an excellent, free tool offered by Google to analyze the traffic and ensure you’re targeting the right people. In this guide, we’ll show reveal the steps you can use to install Google Analytics on your WP website.
Sign Up for Google Analytics
Before you can install Google Analytics or GA on your WordPress website, you need to have an Google Analytics account. If you have one, that’s great! But if not, then you need to sign up. And that’s easy.
Install Google Analytics on your WP Website
There are basically two ways you can install GA on your website. Each one is different from the other in execution terms, but the end result is same.
First go back to the tracking code that GA generated for you when you added your website and URL. If lost, then you can find it under the Admin section. The follow the steps:
Alternatively, you can also add the code to the functions.php file. Add the following code:
Install the plugin like you’d normally do and go to the dashboard. It’ll ask you for the code Google Analytics generated for yourself. Provide the code and it’ll do the editing work. To confirm Analytics was properly installed, go back to your GA dashboard and look for the status.
It will take some time for Google Analytics to start tracking traffic for your website. But once underway, it will show you explicit details at the granular level.
Having a website and driving traffic is not enough if you don’t know whether the traffic is worth. And by worth we mean, whether they’re likely to convert to customers and become profitable. Therefore, you must ensure you’re targeting and driving the right traffic. Google Analytics is an excellent, free tool offered by Google to analyze the traffic and ensure you’re targeting the right people. In this guide, we’ll show reveal the steps you can use to install Google Analytics on your WP website.
Sign Up for Google Analytics
Before you can install Google Analytics or GA on your WordPress website, you need to have an Google Analytics account. If you have one, that’s great! But if not, then you need to sign up. And that’s easy.
- Start by visiting the Analytics registration page. You’ll be using your Gmail ID to sign up.
- Once you’ve signed up, you’ll have to set up an account name. This can be anything you can remember.
- Next, choose a web property you want to track. The options will be a web, app, or apps and web. For your WordPress website, you have to select web.
- Finally, input the website name, URL, country of location, and time zone.
Install Google Analytics on your WP Website
There are basically two ways you can install GA on your website. Each one is different from the other in execution terms, but the end result is same.
- Insert Headers and Footers
First go back to the tracking code that GA generated for you when you added your website and URL. If lost, then you can find it under the Admin section. The follow the steps:
- Log into your WordPress dashboard
- Navigate into Appearances>Theme Editor
- Open the header.php file which is also called the Theme Header file
- Now paste the code you just copied before the closing head tag which is “</head>”
Alternatively, you can also add the code to the functions.php file. Add the following code:
Code:
<?php
add_action('wp_head', 'wpb_add_googleanalytics');
functionwpb_add_googleanalytics() { ?>
// Paste your Google Analytics tracking code from Step 4 here
<?php } ?>
- Install the Google Analytics Plugin
Install the plugin like you’d normally do and go to the dashboard. It’ll ask you for the code Google Analytics generated for yourself. Provide the code and it’ll do the editing work. To confirm Analytics was properly installed, go back to your GA dashboard and look for the status.
It will take some time for Google Analytics to start tracking traffic for your website. But once underway, it will show you explicit details at the granular level.