OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Sitewide Google Analytics Issue

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Sitewide Google Analytics Issue

Postby njeaoeu » Tue Apr 26, 2011 11:14 am

Hey,
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
njeaoeu
 
Posts: 8
Joined: Tue Mar 15, 2011 12:19 pm

Re: Sitewide Google Analytics Issue

Postby asmecher » Tue Apr 26, 2011 11:35 am

Hi njeaoeu,

See http://pkp.sfu.ca/support/forum/viewtopic.php?f=28&t=3901#p27882.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Sitewide Google Analytics Issue

Postby njeaoeu » Tue Apr 26, 2011 11:57 am

That did it!
Thank you so much!
njeaoeu
njeaoeu
 
Posts: 8
Joined: Tue Mar 15, 2011 12:19 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest