Adding Google Analytics To Your Website

Google Mar 10, 2018

Everyone knows the importance of analytics. It has become a necessity on websites specifically for blogs or new products on websites(a lot of many scenarios) to monitor the performance of brands/products/websites and gather information about how people are responding to it.

In this post, I am using Google Analytics as my analytics platform due to following reasons:

  1. It's from Google so trustworthy.
  2. It's free so no money problem.
  3. Very easy to use and manageable. Don't need a big team to manage it.

Prerequisite Steps

To use Google Analytics, you need to complete following steps:

  1. signup with Google Analytics with your personal or business Google credentials and it will

  2. Create a property. The property will provide a unique key called Tracking Id that needs to be added to your website to start tracking. To do that, go to Admin > Create new property


    Tracking Id looks like this UA-XXXXX-Y

How to add this tracking Id to your website

To add this tracking Id, google analytics create a generic code with your tracking id to be included anywhere on your website. You can find your tracking code by going into your newly created property then Tracking Info > Tracking Code. Just paste the code into your website or specific page and it will start sending your traffic details to Google. The code looks like below:

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

You can find more details on google official page Adding analytics.js to Your Site

Hope this helps!!

Display Page Views On Your Pages - Google Analytics

Server Integration With Google Analytics

Related Tags:

Google   JavaScript   Analytics