In short: What is Google analytics & Why we need it?
Google analytics is a Google product which tracks the activities on Website, Mobile App, or any device that is operated digitally. It could be your microwave or refrigerator as well 🙂 How cool right…..
In this topic, we will see how to create an Analytics account and configure it to track the activities like visits, interactions, pages, visitors etc on the normal website.
Step 1: Create / Use Google Account /How Do You Sign up For Google Analytics?
Before setting up an Analytics account, you would need a Google / Gmail account or email id. So, create any Gmail id or use the existing one. e.g. firstname.lastname@example.org
Now, you can use this Gmail account for all the Google products like Adwords, AdSense, YouTube, Analytics, Blogger, etc.
Step 2: Login to Analytics: Sign in to your Analytics account.
Once you have your Google account. You can log into the Analytics tool using the link https://analytics.google.com/. You can associate your personal ids like email@example.com to Google account and use that for setting up the Analytics account as well.
On login, into the account/tool you will see these 3 options and by clicking the ‘Sign Up’ button the next you will see the beautiful Google analytics setup interface.
Under the ‘New account’ you will notice 2 options ‘Website’ and ‘Mobile App’. By default, it is ‘website’. You can create 100 Google analytics account under one Google account.
Setting up your analytics account:
Select ‘Website’ and fill up the required details like ‘Account Name – Main Analytics Account’. This will be the main account under which 1 or more analytics properties or tracking ids can be created.
Setting up your analytics property:
Now, one Account here in our case it is ‘Main Analytics Account’ can have 50 properties. Each property will have 25 views. (That will talk later)
Fill up the following details carefully:
Website Name (required) – Name of your website. E.g My Guest Post
Website URL (required) – Select the URL with version http or https
Industry Category – You can select the business category for your website
Reporting Time Zone – Select correct reporting time zone, to avoid further confusions
And click on ‘Get Tracking Code’. After accepting the Google terms and conditions you will get an ‘Analytics Tracking Code’ / Universal Analytics UA Code.
Step 3: Google Analytics Tracking Code / Universal Analytics Code
Now, this is the code full of functions and magic. 🙂 This you will need to add to the website to complete the tracking process. By the way, just for your information, Google analytics code work heavily on Cookies…not the eatable one…the browser cookies. There are many types of cookies which help to track codes to get the data from the website based on the user interactions. E.g. Time, Date, Duration, IP, Country etc.
Step 4: Where do you put Google Analytics code?
Now the next question is How to add Google analytics code snippet to the website?
There is mainly 4 type of methods through which the code can be added or linked to the website.
1. Copy + Paste Method
The mostly used method is the copy-paste method. You just need to copy the tracking code containing the UA id and paste it into the website before closing the <head> tag in the main header file. So that it appears on each and every page. See the below Google analytics code example.
Also, this is how you can tell if a website has Google Analytics or not. Simple.
This again can be done via multiple ways:
- Using Plugins: Incase of WordPress website, there are many plugins which will give you the option to add the Google analytics code to the website.
- Manually: If the website is small (say 5-10pages) and is static (.html) then you can just put the tracking code in each page manually.
- Single File (Header.php): In PHP websites, (even in WordPress) the code can be added to the main header.php file which will add the code automatically across the web pages.
2. PHP Implementation
Use the tracking code to create a file named “analyticstracking.php”, and include the file on each PHP template page.
Add the following line to each template page immediately after the opening <body> tag “<?php include_once(“analyticstracking.php”) ?>”
3. Dynamic Content Implementation
Use a common include or template to paste the code above instead of manually adding it to every page.
4. Google Tag Manager
There is one free tool Google Tag Manager can help you add tags to your site if you have multiple analytics and tracking tags.
Consider using Google Tag Manager if:
- You use multiple analytics and ad performance tracking tools that require site tags.
- Adding tags to your website slows down your ability to run marketing campaigns.
Learn how to get started with Google Tag Manager https://www.google.com/analytics/tag-manager/
Step 5: How do I know if Google Analytics is working?
Once the code is added to the website, we need to check if it is working fine or not. There is a simple method to do that.
Just go to the ‘Real Time’ report segment. As open the website URL in another browser (ensure the ISP/IP is not blocked already). This will show you the live/real-time visitor on the website.
Hurray…..we are done with the setup. Now the next part will be the configuration of the account in which we will talk about the filters, goal settings, linking Adwords, Adsense, and webmaster etc.
Please let me know your thoughts by posting the comments below.