Monitoring your WordPress website traffic regularly plays the vital role towards success.
There are several plugins including the Google Analytics plugin in the WordPress official page.
But, If you don’t like to use a plugin to tracking your WordPress website, then you can do it without a plugin as well.
Why should you add Google Analytics to WordPress website
Understanding the traffic or users coming to your website has a huge role to play.
You will understand how your readers are
- interacting with your content,
- The amount of time spending on a page
- from where the audience coming from
- Page getting the maximum views or fewer views.
- you social, organic, referral and direct traffic too and more
And these statistics should be measured, to work on the things which are going wrong.
This step by step tutorial will help you add Google Analytics to WordPress without a plugin.
Add Google Analytics to WordPress without Plugin
Make sure you have signed up and created a Google Analytics account for your website.
Step 1. Login to your Google Analytics account.
Step 2. Click on Admin button, which can be located at the bottom left. (It will look like a gear icon)
Step 3. Now Click on the domain on which you want to add the Google analytics, and then click on All Web site Data.
Step 4. Here, you would be able to see one more dashboard, for tracking that domain.
Step 5. Among the columns, choose tracking Code from the Property column, better insights show in the image.
Step 6. This will give a website tracking code, along with the unique ID for tracking it. (Starts with UA-)
Step 7. Copy the entire code from the Google Analytics and switch back to your WordPress Admin Panel.
Add Google Analytics to WordPress Theme
Now we are here, about to add the Google Analytics code to your WordPress theme.
Step 8. Navigate Appearance – Editor from your WordPress dashboard.
Here you would be able to see all the themes files with .php extensions on the right side of the WordPress Dashboard.
Step 9. Scroll down and find header.php (Theme Header), click on it to open
According to the themes, the Theme header title might vary, but the name header.php would be the same.
Step 10. Find </head> tag in the header.php file and finally paste the copied Google Analytics tracking code above it.
Step 11. Click on the Update button, and you were done.
Now Google Analytics will start tracking your WordPress website traffic. This process would be useful if one doesn’t want to install a plugin for tracking the website.
Note: If you update or change your theme, you might want to do this process again, as we have installed the GA code directly in the theme itself.