Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics: External .js file

Just to confirm...

file: google.js

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"));

try {
var pageTracker = _gat._getTracker("UA-11510668-1");
pageTracker._trackPageview();
} catch(err) {}

And then linking the file like:

<script src="google.js" language="javascript" type="text/javascript"></script>

That works, right?

like image 357
n00b Avatar asked Mar 02 '10 14:03

n00b


1 Answers

Add that script to your page, then if you're using FireFox w/ FireBug (or other debugger) or Chrome, you can Inspect Element to see what's been written to the page. If you see...

<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>

...then you should be good to go!

like image 90
hunter Avatar answered Sep 30 '22 05:09

hunter