Are you searching for a simple and proper solution of inserting the Google Analytics tracking code to your WordPress website? Or, Still; You are curious to know about “How to add Google Analytics tracking code to your WordPress website with the help of plugin and without a plugin?”
So, Here you are at the right place to learn and get your proper solution of this query without any complication.
Now be ready and concentrate here to get your solution.
Before jump to the learning methods of adding Google Analytics code to WordPress, you should be aware of “how to get the Google Analytics tracking code?”
How to get the Google Analytics tracking code?
To get the Google Analytics tracking code, follow the below steps.
Step 1: Go to Google Analytics site by clicking here, or simply type “Google Analytics” in Google search and click on the first link of the search result as seen below.
Step 2: Sign in with your existing Gmail account.
Enter your existing Gmail id and password to connect with Google Analytics.
Step 3: After sign in with your Google Gmail account, Just click on the “Sign up” button to create the Google Analytics account.
Important things to learn before creating a Google Analytics account and getting the Google Analytics tracking code.
- The “Account Name” of Google Analytics could be universal (same for many websites). Which contains more than one tracking code according to the number of websites you are added to that specific Analytics account.
- You can also create up to 100 accounts in Google Analytics to manage your website or apps easily through the admin panel of Google Analytics account.
- A Google Analytics tracking code is only for the individual website, which you have entered to get the tracking code. If you want to add your another website with Google Analytics account and get the tracking code, then you will have to create another property through the Google Analytics admin panel to get the tracking code.
This will be your brand new Google Analytics account creation registration form. So, to be careful while entering your information related to the website.
Step 4: Just enter the data like Google Analytics account name, website name, website URL, website category, and your time zone. Enter the website URL without HTTP/HTTPS because it’s already mentioned to choose anyone.
Take a look at the below image to creating a new account of Google Analytics.
After entering the all required data, click on “Get Tracking id”.
Step 5: Now you will have to accept all the terms of Google Analytics to get the Google Analytics tracking code.
Here is the Result! Google Analytics tracking code after following the above steps carefully.
We learned how to get the Google Analytics tracking code with the help of the above simple way.
Now the time to learn “How to add a Google Analytics tracking code to a WordPress website”.
How to add Google Analytics tracking code to WordPress website?
You will learn two methods in this post to add the Google Analytics tracking code to a WordPress website.
- Add Google Analytics tracking code with a plugin (Simple and Recommended)
- Insert Google Analytics tracking code manually by editing the theme header file of the WordPress website (Advanced and complex)
1. Add Google Analytics tracking code with a plugin (Recommended)
This is the very simple and recommended method to easily add the Google Analytics tracking code into a WordPress website.
Follow the below steps to add the Analytics tracking code to WordPress.
Step I: Open your WordPress website dashboard and click on “Add new” by navigating the Plugins>Add New section of your WordPress dashboard.
Simply search the “Insert headers and footers” in the search bar of Add plugins section as seen in below image.
Click on “Install Now” and then “Activate”.
You may directly upload this plugin by clicking on “Upload Plugin” after download it through the WordPress site.
WordPress plugin Download link: Insert Headers and Footers
Step II: Just click on the “Insert Headers and Footers” option by navigating the Settings>Insert Headers and Footers in your WordPress dashboard section.
Take a look at the screenshot of “Insert Headers and Footers” plugin, which you will view after opening them.
Step III: Paste your Google Analytics tracking code in the “Scripts in Header” area. As you can look at the below screenshot.
Now, everything has been done perfectly to successfully get your result.
So, Just click on the “Save” button to add the Google Analytics tracking code to the WordPress website.
A benefit of using the “Insert Headers and Footers” plugin is when you change your WordPress theme, it will always be inside the header of your new theme also. So you don’t have to worry in the future about the Google Analytics tracking code.
Note: If you uninstalled the “Insert Headers and Footers” plugin, then the tracking code will automatically be removed from the WordPress website header. So keep in mind before doing this same.
2. Insert Google Analytics tracking code without a plugin (Advanced)
Inserting Google Analytics tracking code manually without a plugin by editing the theme header file of the WordPress website is Advanced and complex to implement the task.
If you are not familiar with at least understand the structure and syntax of coding, then avoid this advance method to add the Google Analytics tracking code to WordPress website.
Click on the “Theme Editor” by navigating the Appearance>Theme Editor on the dashboard of WordPress.
And just choose and open on the “Theme header (Header.php)” file.
Carefully identify the <head> and </head> tags in the header.php file to insert the Google Analytics tracking code.
Take a look at the below image and understand how I inserted the tracking code between the <head> and </head> in the header.php file of the WordPress theme.
After inserting the tracking code into the correct tags of the header.php file. Just click on the “Update File” to successfully insert the Google Analytics tracking code into the WordPress website header.
How to verify Google Analytics code working or not?
After adding the Google Analytics tracking code to the WordPress website, you can verify its working by the below method.
Method 1: This is the simplest method to verify the Google Analytics code is successfully working on your WordPress website or not.
Just open your website on any device’s web browser and visit any webpage of your website.
And then, open your Google Analytics account on a desktop or Google Analytics app. You will see the realtime view of your website page by just clicking on the realtime overview option on the Google Analytics dashboard section.
Method 2: This is the advanced method to verify the Google Analytics code inserted into your WordPress website or not.
Okay! So, Just open your website on desktop and right-click on the background of your website’s webpage and click on the “View page source”. Where you will find a Google Analytics tracking code tag.
Take a look at the below screenshot to identify the Google Analytics tracking code.
I hope you learned the methods of adding the Google Analytics tracking code to a WordPress website, along with how to get the Google Analytics tracking code. If you have any doubt, query, and suggestion regarding this tutorial, then you can comment below. I will try to solve your problem as shortly asap.
Please follow Blogsnode on the social network to get connected with us!