JSPWiki & Google Analytics

I am a user of Google’s Analytics service. This Google service allows a website administrator to track and analyze web usage traffic for a website. For instance one can learn what pages are being viewed and when the pages are being viewed.

I am user and fan of JspWiki which is a wiki that can be run in side of a Java EE application server.

Google Analytics creates a script segment for the web administrator to add to each of the pages he/she would like tracked by the Google Analytics service. Wikis by nature hold dynamic user generated content so I was looking for the best practice of how to add the Google Analytics code snippet to JspWiki so that all the pages would be properly tracked.

A couple of members of the JspWiki mailing list offered solutions to my issue of how to best integrate Google Analytics with JspWiki. Janne offered a very good synopsis regarding how to integrate the Google Analytics service with different versions of JspWiki. To paraphrase Janne:

In version 2.5.x, put the code segment from Google Analytics in localheader.jsp.
In version 2.4.x would put it in the code segment from Google Analytics in commonheader.jsp OR ViewTemplate.jsp

If you click on this link you will be taken to the list archive where you can see my original question and a few different responses, including Janne’s.

The solutions offered by the list members are working great for me. I added my Google Analytics code snippet to ViewTemplate.jsp just before the closing body tag.