How to Add Google Analytics to WordPress Website

If you are start to build your first website, you may only know how many visitors you get via stats of your website. However, due to your blog growth, you need to have a stats program which help you to track blog traffic and analyse them. Google analytics is one of the free stats program that is must-have for any website. It helps your websites monitor traffic and identify trends in site visitor behavior that could, ultimately, impact marketing, conversions, revenue, and profits.
In this tutorial, I will show you how to set up your Google analytics account and adding Google Analytics into your WordPress website.

How to Setup Google Analytics Account

In general, in the 1st time setup Google Analytics, you will need to create an account by adding your website details and your personal details to get started. If you already have an Google Analytics account, you can navigate to the Admin page and add new property.


You need to add your website details on the next page to get the tracking code by clicking on Get tracking ID


Now you will be moved to the page with tracking ID for your website.

google-analytics-tracking-IDCongratulation!! You have successfully setup your Google analytics account and created the tracking ID for your website. Now all that is left is integrating Google analytics tracking ID into your WordPress blog.

Add Google Analytics to WordPress Using your WordPress theme

Most of  WordPress themes have an option to add header and footer script so you can use this to add Google Analytics tacking code into your blog. It will work seamlessly and more over.
If you had already property, looking for the “Tracking Info” link in the “Property” column. Under “Tracking Info” click on “Tracking Code”


Now you can see a new section includes a snippet JavaScript tracking code (the same as result of step 1). Copy the code, and get ready to paste it into place on your WordPress site.
From the Dashboard select “Appearance” >> “Editor” to open up the theme editor to modify your WordPress theme files. If you have trouble saving changes for some reason, check your server to ensure that the theme files may be overwritten.


Google Analytics tracking code may be placed in either the WordPress header file (header.php) or footer file (footer.php). For example, the tracking code will be add in the header. Under the Templates column locate the Theme header (header.php) file and click on, so that it is the active file.


In the editor, locate the closing head tag, which has a forward slash (/) before the word “head” inside of HTML’s characteristic brackets.


Locate the closing head tag in the code. Add a couple of new lines and paste the Google Analytics tracking code into the header.php file just about the closing head tag.


Paste the Google Analytics tracking code in place and save the changes.
Save the changes and update the file, Google Analytics now could be installed.
Try clicking around on the site and checking out the Real Time analytics from the Google Analytics interface to ensure that everything is working correctly.

Add Google Analytics to WordPress Using plugins

There are multiple methods to add Google analytics into your Website, but for non-technical users, you don’t have to worry about tech-how of Google analytics & WordPress integration by support of many plugins which are available to add Google analytics to your WordPress website. One of the most appreciated plugins is Google Analytics Dashboard for WP plugin.

You also can use Google Analytics for WordPress plugin . This plugin provides an interface for WordPress users to set up a few custom variables like tracking a post author from a plugin options page. For sites that are using content marketing to promote transactions, this plugin can be very helpful. Also, if you install this plugin, you do not need to add Google Analytics tracking code, but rather have verify your Google Analytics account with the plugin and allow it to add the appropriate tracking code for you.


Hopefully that this article can helps you know how to set up your Google Analytics account and how to add Google Analytics into your WordPress Website.  See you again in orther tutorials!


Leave a Reply

Your email address will not be published. Required fields are marked *