Google Analytics without JavaScript

By: | In: Sci-Tech |

This article will guide you in implementing i.e. using Google Analytics on your Website or Blog without JavaScript.

Things you will need

  • Google Analytics Account
  • Basic Knowledge of HTML and JavaScript

Step 1- Handling Google Analytics tracking code

You need to have Google Analytics code. You can ignore step-1 if you have Google Analytics code else  if you don’t have you can learn and can get by following below instruction-

Advertisement

  • Login to your Google Analytics Account (http://www.google.co.in/analytics/).
  • Choose the website for which you the Analytics code.
  • Click on the Admin tab and then under the Property Column Click on Tracking Info and select Tracking code option

On Clicking Tracking code option some JavaScript will appears in the right side of the sidebar menu, for your convince example is given below.

 <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’,’//www.google-analytics.com/analytics.js’,’ga’);

ga(‘create’, ‘UA-123456789-1‘, ‘yourwebsite.com‘);
ga(‘send’, ‘pageview’);

</script>

Step 2- Creating your own tracking code without JavaScript

  • Copy your Google Analytics Tracking ID, you can get this from the tracking code provided by the Google Analytics account (See first step if you need help).  It is in the following format UA-123456789-1, for reference see the above example.
  • Replace “Your Site tracking  here” below with your tracking ID and yourwebsite.com with your domain name.

<img src=”http://nojsstats.appspot.com/Your Site tracking  here/yourwebsite.com“/>

Now copy above code and paste it anywhere on your website or blog. You can also use <noscript> tag to tell the Browser to include only in case of JavaScript is disabled. See below example

<noscript><img src=”http://nojsstats.appspot.com/Your Site tracking  here/yourwebsite.com“/></noscript>

Now Cheers! Hope this will help you

Be First to Receive Useful & Interesting Emails You are 100% Secure as per our Privicy Policy

Also See:

Need Help? For instant and detailed answer ask your question at Isrg Forum

Related Articles