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
--
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