Google Analytics

ganalytics.png

Google Analytics is the enterprise-class web analytics solution that gives you rich insights into your website traffic and marketing effectiveness. Powerful, flexible and easy-to-use features now let you see and analyze your traffic data in an entirely new way.

http://www.google.com/analytics/

If you want to learn more about who is visiting your site and what pages they are reading, this is a must-have add-on to your Onpub website.

To get started, click the link above to log in to Google Analytics. Follow the instructions to setup a profile for your website.

Follow the steps below to integrate the tracking code in to your Onpub frontend:

  1. In your Onpub installation directory you will find a directory called local. In the local directory, create a new file called: onpub_head.php
  2. Open onpub_head.php in your favorite text editor, paste in the Google Analytics tracking code and save the file.

That's all there is to it.

The Onpub frontend is programmed to automatically include the contents of the onpub_head.php if the file exists in the local directory. The next time you reload the frontend in your browser, the tracking code will be automatically included in the right place. You can view the HTML source code in your web browser to confirm that this is true.

The contents of  your onpub_head.php file should now look similar to the following code:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-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>

Make sure you replace the example profile ID ('UA-XXXXX-X') in the above code with your own GA website profile ID.