TechHow to Deploy Google Analytics without JavaScript?

How to Deploy Google Analytics without JavaScript?

Analytics from Google is a powerful tool that helps you to collect deep insight from your website, blog and apps. The Google Analytics is loaded with tons of powerful tools including live insight of the hits and visits on your website. The Google Analytics is integrated by placing the snippet of JavaScript code which may not execute on the browsers with JavaScript turned-off and because of this, you may miss out most of the insight. This article will guide you in implementing and deploying 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-

  • 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 appear in the right side of the sidebar menu, for your convince example is given below:

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
ga('create', 'UA-123456789-1', '');
ga('send', 'pageview');

Step 2- Creating your own tracking code without JavaScript (depreciated see method #2)

  • Copy your Google Analytics Tracking ID, you can get this from the tracking code provided by the Google Analytics account (See the 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 with your domain name.
<img src=""/>

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

<noscript><img src=" Site tracking  here/"/></noscript>

Tracking Google analytics without JavaScript method #2

Since the first above method has depreciated, we have another method to track Google Analytics insight without JavaScript.

You need to insert an image wherever you want to deploy the tracking without Javascript with the help of <img> tag or CSS background property loading image from and passing the important parameters with values.

tidYour GA tracking ID in format UA-123456-XX
zAny random string to prevent the browser caching. You can use the PHP rand() function to generate a random string.
vGoogle analytics version by default, it should 1
tEvents to be tracked by default it should be the event
eaEncoded URL that to be tracked; you can use urlencode() in case of PHP

Isrg Team
Isrg Team
Isrg Team is a member of Digital Pradesh News Networks, a collective of journalists, reporters, writers, editors, lawyers, advocates, professors, and scholars affiliated with the Digital Pradesh News Network.

Latest Updates