I've been having a problem setting Google Analytics sitewide.
I know that there is a plugin, but the problem is that I don't want to have to individually enable the plugin for all the journals.
I've done a bit of searching here and found that I could simply add the Google Analytics javascript snippet to
templates/common/footer.tpl
and to
templates/article/article.tpl
The problem is that after adding
- Code: Select all
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxx-x']);
_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>
(xxx-x being the proper ID), it still doesn't work.
When viewing the page source, it shows the following:
- Code: Select all
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22743340-1']);
_gaq.push(['_trackPageview']);
(function() )();
</script>
Why is the function empty when I view the page source?
Anyone have any idea?
Thanks,
njeaoeu
