Google Analytics for the UNL Templates

From Web Developer Network Wiki
Jump to: navigation, search

Google Analytics is the preferred web analytics tool in the WDN Templates. It is installed on every template page, however departments must connect their individual accounts with their sites in order to view the data.

Contents

Google Analytics Version

In December 2009, Google released the Google Analytics Asynchronous Tracking Code. This code allows for an updated, more efficient way to collect Google Analytics data, while maintaining a better user experience for our end users.

Beginning October 7, 2010, unl.edu began using the async tracking code. Due to recommendations by Google and the nature of async tracking, the older non-async method will be deprecated effective October 22, 2010. In order to ensure no loss in analytics data, developers must upgrade immediately.

Implementing Google Analytics on Individual Department Sites

Implementing Google Analytics on department sites is even easier with the async code. To do so, simply add this code anywhere in your pages:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-1']); //replace with your unique tracker id
_gaq.push(['_setDomainName', '.unl.edu']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
</script>

Note: Do not add the default call for the ga.js file as provided by Google. It will already be loaded, and duplicating will slow down your site and could cause date inaccuracies.

Implementing Google Analytics in UNL CMS

For users in the UNLcms, after enabling the Google Analytics module select Modules>Google Analytics>Advanced Settings>Custom Javascript Code and add the following:

_gaq.push(['_setDomainName', '.unl.edu']);
_gaq.push(['_setAllowLinker', true]);

See screenshot for details:

UNLCMS GA.png

Google Analytics Customization

In this section, tips and tricks used by departments with Google Analytics can be shared.

Filter Internal/External Traffic

Instructions for creating profiles with internal/external traffic segments are available on this video: http://mediahub.unl.edu/media/3150.

Setup Local Site Search

If you are using Google Custom Search on your site and would like to track site searches, simply:

  1. Login into your Google Analytics account and edit the profile for which you would like to add the search tracking. Note: Each profile for site search should be tracked must be setup individually.
  2. Click "edit" next to the Main Website Profile Information.
  3. Select the "Do track site search" option under the "Site Search" section
  4. For the "Query Parameter" input box, enter:
    q
  5. Select the "Yes, strip query parameters out of URL" option.
  6. Select "No" for the "Do you use categories for site search?" question

Track Links to Documents

This is done by default in the UNL Templates. All files ending with .zip, .exe, .pdf, .doc*, .xls*, .ppt*, .mp3, .mp4 are accounted for. The href value for the link is what will be reported in your Top Content Report.

To find these in your Top Content report, use the regular expression in "Filter Page" input box:

\.zip|\.exe|\.pdf|\.doc|\.xls|\.ppt|\.mp3|\.m4v

GA Top Content File Filter.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox