Fullscreen
[Show/Hide Right Column]

Plugin Google Analytics

This Wiki Plugin provides a simple way to add the code snippet needed for Google Analytics to work on your site. Google Analytics will provide various types of detailed traffic reports and statistics for you to use to monitor the traffic on your Tiki site. See also Piwik.


Syntax and Parameters

This plugin uses the following syntax:
{GOOGLEANALYTICS(account=xxxxxxx-x) /}

Additional syntax is also needed to implement this plugin - see the next section for the implementation steps.

This plugin only requires one parameter as follows:

Parameter Accepted Value
account XXXXXXX-YY (the portion of your Google Analytics account number after UA-)

Steps for Using This Plugin

Since Tiki3

  1. Open Google Analytics account
    If you don't already have an account, go to http://www.google.com/analytics/ to open one. When setting the account settings, choose "A single domain" when asked what you're tracking. If you choose another setting, you won't be able to use the plugin - use the instructions below for prior Tiki versions instead.

  2. Go to Look & Feel admin panel
    Go to Admin Home > Look & Feel > General Layout Options (tab)
    NOTE: For tiki7, go to Admin Home > Look & Feel > Customization (tab)

  3. Insert Syntax and apply
    Go to the box titled "Custom End of Code" and insert the following and then click "Apply":
    {wiki}{literal}{GOOGLEANALYTICS(account=xxxxxxx-x) /}{/literal}{/wiki}

    tipTip
    Note: use your Google Analytics account number where the x's are shown above. Do not include the "UA-" part of your account number.

    tipTip
    Note: if you can't get the GOOGLEANALYTICS module to work, you can do something like this (also excludes admins from generating Google Analytics hits, and sets cookie so you can use G/A filters to exclude Admin hits even when not logged in):
    {if $tiki_p_admin ne 'y'}{literal}<script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
      _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>{/literal}
    {else}
    {literal}<script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
      _gaq.push(['_trackPageview']);
      _gaq.push(['_setVar', 'ga_exclude']); 
      (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>{/literal}{/if}
See

  1. Check stats
    Go to http://www.google.com/analytics/ to see the stats for your site.

Go to this Google help page to see the code that will be inserted at the end of each page as a result of following these steps.

Prior Tiki Versions

This plugin didn't exist before Tiki3, but the code snippet that Google provides when you open a Google Analytics account can be added in prior versions as follows:
  • Version 2.0: add to the footer at Admin Home > Look & Feel
  • Version 1.9: add to templates/footer.tpl. Need to set "Edit templates" first in the Look & Feel admin panel


Aliases

Google Analytics


Contributors to this page: SteveH412 points  , Daniel Gauthier1231 points  , Rodrigo Sampaio Primo1690 points  , Marc Laporte9146 points  , petjal468 points  , lindon137 điểm  , pascalstjean548 points  and stefbrodu89 points  .
Page last modified on Sunday 28 August, 2011 19:15:42 UTC by SteveH412 points .
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.

Site Language

Reference Guide

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):



Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki