Tags:
pattern_skin1Add my vote for this tag create new tag
, view all tags

Question

Hello all,

Which is the best way to add google analytics tag to my TWiki? I've to edit by hand every template files?

Environment

TWiki version: TWikiRelease04x00x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Plugins, Add-Ons, Skin

-- StefanoCislaghi - 06 Jun 2006

Answer

For PatterSkin: create a new javascript.*.tmpl file in /templates, for instance javascript.analytics.tmpl.

In that file, write:

%TMPL:INCLUDE{"javascript.pattern"}%

%TMPL:DEF{"twikijavascript"}%<script type="text/javascript" src="%PUBURLPATH%/%TWIKIWEB%/TWikiJavascripts/twiki.js"></script>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
_uacct = "your-code";
urchinTracker();
// ]]>
</script>
%TMPL:END%

In your Main.TWikiPreferences (not TWiki.TWikiPreferences), set:

    *Set SKIN = analytics,pattern

This is from the top of my head and untested. Let me know if you succeed.

-- ArthurClemens - 06 Jun 2006

That seems to work allright... although there is also a GoogleAnalyticsPlugin plugin, which more or less does the same thing.

-- OlivierBerger - 22 Jan 2008

Apparently, this has changed in 4.2? There is no "javascript.pattern" to INCLUDE in the template file. Following these instructions have no apparent impact on our TWiki (the script does not get added to the source of the pages). Can anyone point me in the right direction?

-- DavidWolfe - 27 Aug 2008

Sorry, closing after more than 30 days. Please reopen with more details if needed...

-- PeterThoeny - 06 Nov 2008

 
Topic revision: r7 - 2008-11-06 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.