2011-04-17

How to use Google Analytics with MoinMoin wiki engine?


To start using Google Analytics, You must place some piece of code into Your site's webpages. What should be done, if Your site uses MoinMoin wiki engine as website revision system (WRS or CMS)? Where to place the code?


I use MoinMoin wiki engine as WRS (CMS) at my family's website. Now I am trying to improve the davimas.name's design, make it more user-friendly and better understandable. It seems reasonable to use Google tools for this task. Google's blogger.com and feedburner.com gives me the instruments to start blogging quickly and to analyze the efficiency of some newsfeeds. Google Analytics and Google Webmaster's Tools give the another opportunity to analyze website's popularity and to interact with Google's search engine "directly".


Suggest You have taken needed code from Google Analytics. If not, read here about how to do it: http://www.google.com/support/analytics/bin/static.py?page=guide.cs&guide=19779&topic=19783

Now just open Your site's wikiconfig.py and place the Google's code as it shown below.

# Set these in wikiconfig.py

sitename = u"Your site's name here"
theme_default = 'rightsidebar'
theme_force = True

page_front_page = u"SiteContents"
language_default = 'en'
language_ignore_browser = True

acl_rights_before = u"YourUserName:read,write,delete,revert,admin"
acl_rights_default = u"All:read"

html_head = '<link rel="shortcut icon" href="/favicon.png">'
logo_string = u'<img src="/htdocs/your_logo.png" alt="YourSite.com Logo">'
page_footer2 = """Google Analytics Code Here"""
page_credits = ["this sets the",
 "credits like 'Valid HTML'", "in the footer"]

navi_bar = [
    u'%(page_front_page)s',
    u'RecentChanges',
    u'FindPage',
    u'ContactMe',
    u'OtherPageYouWant',
    u'AndSoOn',
]
This idea and example I find at Stephan Sokolow’s Blog: http://blog.ssokolow.com/archives/2008/02/13/moinmoin-as-a-plain-old-cms/


If You can not find line with page_footer2 at wikiconfig.py (my case), nothing terrible! Just make it! Place this new lines just after the navi_bar = [...]:
navi_bar = [...]
# Google Analytics code
page_footer2 = """Google Analytics Code Here"""
And it works! :)