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
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

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: 8479
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: Google [Bot] and 1 guest