• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!


Setting Up Google Analytics

Page history last edited by PBworks 13 years, 11 months ago

This is for version 2 of Mobile Web OSP. Version 1 doc.


Configuring Google Analytics

I'm assuming that you know how to go to Google Analytics and set-up a report for your new mobile site. Once you've gotten the code (it should look like UA-XXXXX-XX) do the following:


  1. Navigate to the root of your Mobile Web install
  2. Open config.gen.inc.php in your favorite text editor
  3. Add your code to line #15 for the variable $ga_code


That's all you need to do. Mobile Web OSP will use Google Analytic's mobile version on devices using the basic template. Devices using the touch and webkit templates will utilize the full JavaScript version.


Tracking Outgoing Links & Customizing Link Tracking

I've tried to set-up the touch and webkit templates in the Mobile Web project to also report when a user leaves your site for another website. Clicks on outgoing links can be found under the fake directory '/outgoing/' and are organized by the section the links are in. For example an outgoing link in the Campus News section would be under '/outgoing/news/.' YouTube clicks are not recorded though.


In order to provide your own custom links for webkit templates you can add the 'data-ga' attribute to your links. Mobile Web OSP contains custom code that will change the value for the 'data-ga' attribute into the proper Google Analytics _trackPageview request. For example:


<a href="http://www.inst.edu/" data-ga="/outgoing/homepage/">Link</a>


In order to provide your own custom links for touch templates you must explicitly write out the _trackPageview onclick event. For example:


<a href="http://www.inst.edu/" onClick="javascript: pageTracker._trackPageview('/outgoing/homepage/');">Link</a>



Comments (0)

You don't have permission to comment on this page.