Sample Code to Integrate Google Analytics in a HTML page

Sample Code to Integrate Google Analytics in a HTML page

Google Analytics is one of the most popular On-line tracking System in the world. Including real-time visitor statistics it provides many rich features like data visual, various kind data analysis reports, export options or user access control.

The below Code is to integrate Google Analytics to a HTML page. Just Copy n Paste the below Code after your HTML page end body tag. Here one more thing you need to update is the tracking ID. Which is unique as per Google records. Here I used the demo key is “UA-5736446-2”. Update this to yours.

Codes to Integrate Google Analytics

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-5736446-2");
pageTracker._trackPageview();
} catch(err) {}</script>