Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

miknos

Suspended
Original poster
Mar 14, 2008
940
793
It is possible to use reference link in Google Analytics?

Let's say <link rel="javascript" href="analytics.js"> instead of:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-912730-5']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
 
Yes I did this. It works perfectly fine and I linked it to all of my pages and it identifies them as different pages in analytics still.
 
Thanks for answering.

Nice to know code can get even cleaner that way.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.