Google Analytics is by far the best Analytics tool out there and I highly recommend it to anyone who wants to have free website analytics in his website. It is free and comes with tons of features which will help you gain more insights on what’s happening in your website, users, demographics, user behavior, content engagement and much more.
If you are a beginner and just starting up with Blogging or making money online, I would highly recommend you to first setup an analytics solution in your blog or website. Without analytics, you will now know what works for your site and what doesn’t. You will have to continuously use analytics solutions to see which pages are bringing traffic, which pages are converting more and accordingly develop your site based on those business metrics.
Creating Your Google Analytics Account
Getting started is simple, head over to Google Analytics homepage click on “Sign in” at the right top and then click on “Google Analytics”
In the next page, click the “Sign up” button
In the next page, you will need to add details about your website. Fill in the following details one by one
- Website/App: Website
- Account name: Enter any name, this doesn’t matter but for the purpose of identification, enter the name of your website or domain name
- Website name: Enter your website name here.
- Website URL: Enter the web address of your website without the http:// since the http:// is already added before the input field. You need to add – www.example.com
- Select a proper category
- Select a country and time zone – this should be set to your own country and timezone where you live in. You can always change it later on.
- Next click on “Tracking ID”.
- Accept the terms of agreement (you will need to scroll all the way down and click the “I accept” button)
- Done.
You have just added your website to Google Analytics and in the next page, you will get the tracking code as shown below
That’s all in this step, the next step will discuss how to use the tracking code in your website.
Installing Google Analytics in WordPress
Once you have signed up for Google Analytics, login to your WordPress administration area. Now you would be adding the code which you obtained in the first step.
There are two ways to add the code
- Add the code directly in your WordPress theme.
- Add the code via a plugin.
There are advantages and disadvantages of both methods, which I will explain now.
If you know HTML, PHP and are comfortable with coding, you should choose to add the code directly in your WordPress theme. If you are not comfortable with adding and editing codes of your WordPress theme, you should choose to add the code via a plugin.
One thing to note here is that if you keep changing themes and design of your website very often, it might be a good idea to add the code via a plugin. The plugin will dynamically add the entire code to whichever theme you use for your website.
However, if your website’s theme is static and you do not change it that often, I would advise you to add it directly into your WordPress theme file.
Adding Google Analytics code in your WordPress theme
This is pretty simple, login to your WordPress administration area, go to “Appearance >> Editor” and select theme you want to edit. You will see various files listed on the left hand side of the page.
Try to locate the file which contains the end of the HTML code of your WordPress theme. Usually, there should be footer.php file which should contain the </body> and </html> tag (most WordPress themes are coded that way). In short, try to find the filw which contains the ending body tag.
Once you have found that file, paste the Google Analytics code right before the ending body tag, as shown below
That’s it, you have successfully added Google Analytics into your WordPress website or blog. Give it 24 hours time and you should start seeing traffic and other statistics in your Google analytics account.
Adding Google Analytics code in your WordPress theme via a Plugin
If you do not want to add Google Analytics code directly in your WordPress theme, login to your WordPress administration area and go to “Plugins >> Add New”
Then type “Google Analytics” (without quotes) and search for that plugin. You should see something like below
Once the Plugin is installed, click the “Activate” button, the “Install now” button should change to “Activate”. Once the plugin is activated, go to “Settings > Google Analytics” and you should see something like this
Remember the tracking code you got when you signed up in Google Analytics (refer to step 1). You need to open that tracking code and find the tracking ID from that code which should be in the format of UA-XXXXXXXX-X. Just copy that and paste it into the plugin settings of Google Analytics.
Once that’s done, you are all set. The plugin will dynamically insert the code into your website regardless of the theme that you are using. Wait for 24 hours and you should start seeing website statistics in your Google Analytics dashboard.
Do you still need help integrating Google Analytics into your WordPress website?
If you need help in figuring out how to integrate Google analytics into your website, do drop a comment below and I will personally reach out to you and help you resolve the issue.