User Tools

Site Tools


best_practices:seo_optimized_dokuwiki:integration:google_analytics
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at del.icio.us
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Digg
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Furl
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Reddit
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Ask
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Google
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Netscape
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at StumbleUpon
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Technorati
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Live Bookmarks
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Yahoo! Myweb
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Facebook
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Newsvine
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Yahoo! Bookmarks
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Twitter
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at myAOL
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Slashdot
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Mister Wong

SEO Optimized DokuWiki: Google Analytics Integration

DokuWiki Google Analytics is a web analytics tool for analyzing website traffic. It is a free service offered by Google that generates detailed statistics about the visitors to a website. Its main highlight is that the product is aimed at marketers as opposed to webmasters and technologists from which the industry of web analytics originally grew. It is the most widely used website statistics service, currently in use at around 57% of the 10,000 most popular websites. This article covers how to integrate Google Analytics with DokuWiki.

Google Analytics

The article is part of a series on how to optimize DokuWiki for best SEO results.

This article assumes that you already have a Google Analytics account.

Create new Profile in Analytics

On the overview tab, create a new profile by clicking the “+Add new profile” link on the top right corner of the table:

ga_add_profile.jpg

Select “Add a Profile for a new domain” and enter your URL (not including any folders) and time zone of the Web site:

Example: if your wiki is installed in the subfolder on http://en.mystuff.com/wiki, enter www.mystuff.com as the URL.

Select “One domain with multiple subdomains” under “What are you tracking?” if you follow our setup with one subdomain per language (e.g. de.seowiki.info, en.seowiki.info, …):

ga_tracking_code.jpg

Otherwise, the first option (“A single domain (default)”) should be the one to use.

Integrate Analytics into Template

Now, we need to integrate Google Analytics into the template, to allow tracking of visitors. There is no need for plugins to integrate Google Analytics (anymore). The integration is done in the following files:

  • /lib/tpl/default/footer.html (just before <?php include(dirname(FILE).'/dwtb.html') ?>)
  • /lib/tpl/default/mediamanager.php (just before </body>)

Add the integration code as provided by Google Analytics on the last screen. The code should look similar to the following:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("yourcode");
pageTracker._setDomainName(".yourdomain.com");
pageTracker._trackPageview();
} catch(err) {}</script>

Note that you should use the code as provided by Google Analytics (we have actually used the one provided by the “One domain with multiple subdomains” option on the page Analytics Settings > Profile Settings > Tracking Code). The reason for this is that the code frequently changes and more importantly, you need to replace yourdomain.com and yourcode with actual values associated to your domain.

For best results, edit the Google Analytics profile to allow site search tracking and setup the default page, etc.

First, start editing the profile by clicking the “Edit” link on your profile:

ga_edit_profile.jpg

Next, edit the “Main Website Profile Information” and setup the following information:

Setting Value Comments
Website URL http://www.seowiki.info Should point to some generic URL (in our case the language selection page
Default page start The value provided in the start setting of DokuWiki, see SEO Optimized DokuWiki: Basic Configuration for more details.
E-Commerce Website Not an E-Commerce Site Whatever your wiki content is, it is not an E-Commerce Website (only used for shop systems such as osCommerce)
Site Search Do Track Site Search If you want to know what your visitors are searching for, activate this option
Query Parameter id And select “No, do not strip query parameters out of URL
Do you use categories for site search? No

Hit “Save Changes” button and you have successfully setup site search and the default page of your DokuWiki installation.

Configure Goals

Setting up goals in Google Analytics is more complicated for DokuWiki: DokuWiki fails to provide meaningful URLs that can be used to track those goals.

The first question to ask is what you goals are. In a wiki, typical goals could be

  • user registration
  • adding new content (either editing existing content or adding new content)
  • upload images and other files
  • time on site
  • pages per visit
  • outbound links

User Registration

Tracking user registrations is tricky: because there is no URL for successful registrations, you need to use a trick for tracking it. However, this trick results in many registrations that are not being counted.

<note>If you find a solution to this problem, please update this page.</note>

FIXME one solution to this problem is to add JavaScript handlers to the PHP source code (esp. the media manager upload button. See

for details

On the “Edit Profile” page, click “Add goal”:

Enter the following information on the next screen:

Setting Value Comments
Goal Name User Registration Or any name you like
Active Goal On Should be on by default
Goal Position Set 1, Goal 1 Leave the default or order it the way you want
Goal Type URL destination
Goal Details
Match Type Head Match
Goal URL /start?do=register
Case sensitive no
Goal Value 0.0 Only change this value if you can attach a dollar value to a user registration (are you selling user registrations?)
Goal Funnel
Step URL Name Required Comments
Step 1 /start?do=login Login Screen no
Step 2 /start?do=register Registration Screen no
Step 3 / Welcome Back no This is the trick we are using: we assume that a user who just registered will return to the front page of the wiki
Step 4

Hit “Save Goal” and you are done.

Adding new Content

We added this goal not because it is possible to configure (yet). The problem (or actually advantage) with DokuWiki is that there is no special URL for the edit pages. Therefore, Google Analytics cannot identify edits.

What we would like to track is the number of contributions to the wiki. The most obvious way would be to track edits on the page.

<note>If you find a solution to this problem, please post it here.</note>

FIXME See the following pages:

Upload Images and Other Files

In order to track this goal, you need to make sure that you have modified mediamanager.php (see section before).

On the “Edit Profile” page, click “Add goal”:

Enter the following information on the next screen:

Setting Value Comments
Goal Name File Upload Or any name you like
Active Goal On Should be on by default
Goal Position Set 1, Goal 2 Leave the default or order it the way you want
Goal Type URL destination
Goal Details
Match Type Head Match
Goal URL /lib/exe/mediamanager.php
Case sensitive no
Goal Value 0.0 If you can attach a dollar value to uploads, enter it here
Goal Funnel
Step URL Name Required Comments
Step 1 /lib/exe/mediamanager.php?ns= Initial Media Manager Screen yes
Step 2 /lib/exe/mediamanager.php Return to Media Manager after upload no
Step 3
Step 4

Hit “Save Goal” and you are done.

FIXME See the following pages:

Time on Site

The predefined Time on Site goal allows you to track your targeted visitor duration on your wiki. For example, if your goal is to keep visitors at least 10 minutes on the wiki, use the following setup:

Setting Value Comments
Goal Name Time on Site Or any name you like
Active Goal On Should be on by default
Goal Position Set 1, Goal 3 Leave the default or order it the way you want
Goal Type Time on Site
Goal Details
visits with Time on Site You cannot change this value
Condition Greater than
Hours
Minutes 10
Seconds
Goal Value 0.0 Again, does it make sense to setup a goal value here? Most probably not,
only if you get paid for keeping your visitors on your site

Pages per Visit

Similar to Time on Site, you can track Pages per Visit. Use the following setup to target at least 5 page visits per visitor on your wiki:

Setting Value Comments
Goal Name Pages per Visit Or any name you like
Active Goal On Should be on by default
Goal Position Set 1, Goal 4 Leave the default or order it the way you want
Goal Type Pages/Visit
Goal Details
visits with Pages Visited You cannot change this value
Condition Greater than
Pages Visited 5
Goal Value 0.0

First Back Next Last

  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at del.icio.us
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Digg
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Furl
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Reddit
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Ask
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Google
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Netscape
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at StumbleUpon
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Technorati
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Live Bookmarks
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Yahoo! Myweb
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Facebook
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Newsvine
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Yahoo! Bookmarks
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Twitter
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at myAOL
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Slashdot
  • Bookmark "SEO Optimized DokuWiki: Google Analytics Integration" at Mister Wong
best_practices/seo_optimized_dokuwiki/integration/google_analytics.txt · Last modified: 2011/01/11 12:09 (external edit)