<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Guy Rutenberg &#187; Google</title>
	<atom:link href="http://www.guyrutenberg.com/tag/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Wed, 16 Jun 2010 19:53:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Retrieving Google&#8217;s Cache for a Whole Website</title>
		<link>http://www.guyrutenberg.com/2008/10/02/retrieving-googles-cache-for-a-whole-website/</link>
		<comments>http://www.guyrutenberg.com/2008/10/02/retrieving-googles-cache-for-a-whole-website/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 20:07:30 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/?p=92</guid>
		<description><![CDATA[Some time ago, as some of you noticed, the web server that hosts my blog went down. Unfortunately, some of the sites had no proper backup, so some thing had to be done in case the hard disk couldn&#8217;t be recovered. My efforts turned to Google&#8217;s cache. Google keeps a copy of the text of [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, as some of you noticed, the web server that hosts my blog went down. Unfortunately, some of the sites had no proper backup, so some thing had to be done in case the hard disk couldn&#8217;t be recovered. My efforts turned to Google&#8217;s cache. Google keeps a copy of the text of the web page in it&#8217;s cache, something that is usually useful when the website is temporarily unavailable. The basic idea is to retrieve a copy of all the pages of a certain site that Google has a cache of.<br />
<span id="more-92"></span><br />
While this is easily done manually when only few pages are cached, the task needs to be automated when a need for retrieving several hundreds of pages rises. This is exactly what the following Python script does.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib2</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">socket</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #dc143c;">socket</span>.<span style="color: black;">setdefaulttimeout</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;">#adjust the site here</span>
search_term=<span style="color: #483d8b;">&quot;site:guyrutenberg.com&quot;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    headers = <span style="color: black;">&#123;</span><span style="color: #483d8b;">'User-Agent'</span>: <span style="color: #483d8b;">'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4'</span><span style="color: black;">&#125;</span>
    url = <span style="color: #483d8b;">&quot;http://www.google.com/search?q=&quot;</span>+search_term
    regex_cache = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'&lt;a href=&quot;(http://<span style="color: #000099; font-weight: bold;">\d</span>*<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\d</span>*<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\d</span>*<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\d</span>*/search<span style="color: #000099; font-weight: bold;">\?</span>q<span style="color: #000099; font-weight: bold;">\=</span>cache.*?)&quot;.*?&gt;Cached&lt;/a&gt;'</span><span style="color: black;">&#41;</span>
    regex_next = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&lt;a href=&quot;([^&quot;]*?)&quot;&gt;&lt;span id=nn&gt;&lt;/span&gt;Next&lt;/a&gt;'</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">#this is the directory we will save files to</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
        <span style="color: #dc143c;">os</span>.<span style="color: black;">mkdir</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'files'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">except</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
    counter = <span style="color: #ff4500;">0</span>
    pagenum = <span style="color: #ff4500;">0</span>
    more = <span style="color: #008000;">True</span>
    <span style="color: #ff7700;font-weight:bold;">while</span><span style="color: black;">&#40;</span>more<span style="color: black;">&#41;</span>:
        pagenum += <span style="color: #ff4500;">1</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;PAGE &quot;</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>pagenum<span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;: &quot;</span>+url
        req = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">Request</span><span style="color: black;">&#40;</span>url, <span style="color: #008000;">None</span>, headers<span style="color: black;">&#41;</span>
        page = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>req<span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        matches = regex_cache.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>page<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> match <span style="color: #ff7700;font-weight:bold;">in</span> matches:
            counter+=<span style="color: #ff4500;">1</span>
            tmp_req = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">Request</span><span style="color: black;">&#40;</span>match.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&amp;amp;'</span>,<span style="color: #483d8b;">'&amp;'</span><span style="color: black;">&#41;</span>, <span style="color: #008000;">None</span>, headers<span style="color: black;">&#41;</span>
            tmp_page = <span style="color: #dc143c;">urllib2</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>tmp_req<span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">print</span> counter,<span style="color: #483d8b;">&quot;: &quot;</span>+match
            f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'files/'</span>+<span style="color: #008000;">str</span><span style="color: black;">&#40;</span>counter<span style="color: black;">&#41;</span>+<span style="color: #483d8b;">'.html'</span>,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
            f.<span style="color: black;">write</span><span style="color: black;">&#40;</span>tmp_page<span style="color: black;">&#41;</span>
            f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;">#now check if there is more pages</span>
        match = regex_next.<span style="color: black;">search</span><span style="color: black;">&#40;</span>page<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> match == <span style="color: #008000;">None</span>:
            more = <span style="color: #008000;">False</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            url = <span style="color: #483d8b;">&quot;http://www.google.com&quot;</span>+match.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&amp;amp;'</span>,<span style="color: #483d8b;">'&amp;'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__==<span style="color: #483d8b;">&quot;__main__&quot;</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># vim: ai ts=4 sts=4 et sw=4</span></pre></div></div>

<p>Before using the script you need to adjust the <code>search_term</code> variable near the beginning of the script. In this variable goes the search term for which all the available cache would be downloaded. E.g. to retrieve the cache of all the pages of http://www.example.org you should set <code>search_term</code> to <code>site:www.example.org</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/10/02/retrieving-googles-cache-for-a-whole-website/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Vim Syntax Highlighting For Google Gadgets</title>
		<link>http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/</link>
		<comments>http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 20:26:28 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/</guid>
		<description><![CDATA[I started developing Google Gadgets for LabPixies, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets&#8217; code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I [...]]]></description>
			<content:encoded><![CDATA[<p>I started developing Google Gadgets for <a href="http://www.labpixies.com">LabPixies</a>, so one of the first thing I looked for was syntax highlighting. Vim recognized the gadgets&#8217; code as XML file (which is correct), but I wanted also HTML syntax highlighting for the HTML part. So after searching a bit for some existing solution, I found one, but I didn&#8217;t like as it required me to wrap the HTML code with a specific comment. As I don&#8217;t like this kind of solution, I&#8217;ve decided to create my own syntax highlighting file for Vim.<br />
<span id="more-47"></span></p>
<p>Save the following code under <code>~/.vim/syntax/google_gadgets.vim</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot; Vim syntax file for Google gadgets module files.</span>
<span style="color: #adadad; font-style: italic;">&quot; Maintainer: Guy Rutenberg &lt;http://www.guyrutenberg.com&gt;</span>
<span style="color: #adadad; font-style: italic;">&quot; Last Change: 2008 Mar 28</span>
<span style="color: #adadad; font-style: italic;">&quot;</span>
&nbsp;
<span style="color: #000000;">:</span>syntax clear
&nbsp;
runtime<span style="color: #000000;">!</span> syntax<span style="color: #000000;">/</span>xml<span style="color: #000000;">.</span>vim
&nbsp;
<span style="color: #804040;">unlet</span> b<span style="color: #000000;">:</span>current_syntax
<span style="color: #000000;">:</span>syntax include <span style="color: #000000;">@</span>HTML syntax<span style="color: #000000;">/</span>html<span style="color: #000000;">.</span>vim
<span style="color: #000000;">:</span>syntax region HTMLcode matchgroup=CDATA start=<span style="color: #000000;">/&lt;</span>Content\s\<span style="color: #000000;">+</span><span style="color: #25BB4D;">type</span>=<span style="color: #C5A22D;">&quot;html&quot;</span>\s<span style="color: #000000;">*&gt;</span>\_s<span style="color: #000000;">*&lt;!</span>\<span style="color: #000000;">&#91;</span>CDATA\<span style="color: #000000;">&#91;</span><span style="color: #000000;">/</span> <span style="color: #804040;">end</span>=<span style="color: #000000;">/</span>\<span style="color: #000000;">&#93;</span>\<span style="color: #000000;">&#93;</span><span style="color: #000000;">&gt;</span>\_s<span style="color: #000000;">*&lt;</span>\<span style="color: #000000;">/</span>Content<span style="color: #000000;">&gt;/</span> contains=<span style="color: #000000;">@</span>HTML
&nbsp;
syn keyword javaScriptReserved _IG_Prefs getString getInt getBool getArray set setArray dump _IG_FetchContent _IG_FetchXmlContent _IG_FetchFeedAsJSON _IG_RegisterOnloadHandler _gel _gelstn _esc _unesc _trim _uc _min _max _hesc _args _toggle _IG_GetImage _IG_GetCachedUrl
<span style="color: #804040;">let</span> b<span style="color: #000000;">:</span>current_syntax = <span style="color: #C5A22D;">&quot;google_gadgets&quot;</span></pre></div></div>

<p>And add the following line to your <code>.vimrc</code></p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;">au BufRead <span style="color: #000000;">&lt;</span>google_gadgets<span style="color: #000000;">&gt;</span> runtime<span style="color: #000000;">!</span> syntax<span style="color: #000000;">/</span>google_gadgets<span style="color: #000000;">.</span>vim</pre></div></div>

<p>The current syntax highlighting will highlight the XML part as XML, and if your gadget contains an HTML part, it will highlight it too (including CSS and JavaScript). I&#8217;ve also registered the core JavaScript library of the Google Gadgets API as JavaScript keywords so they will get highlighted too.</p>
<p>The line you added to the <code>.vimrc</code> file will automatically load the syntax highlighting for files of type <code>google_gadgets</code>. While this file type isn&#8217;t automatically detected, you can easily set one by typing <code>:set filetype=google_gadget</code>.</p>
<p>Tip: If you want some file to always be detected as <code>google_gadget</code> add the following modeline to it:</p>

<div class="wp_syntax"><div class="code"><pre class="vim" style="font-family:monospace;"><span style="color: #000000;">&lt;!--</span> vim<span style="color: #000000;">:</span> set filetype=google_gadgets <span style="color: #000000;">:</span> <span style="color: #000000;">--&gt;</span></pre></div></div>

<p>(you got to have modelines enabled for this to work).</p>
<p>Some things are still missing, such as highlighting for all the keywords and methods of the API, and automatic file type detection. I plan to address those issue as time will permit me. If you think I&#8217;ve left out some important functionality that should belong with this code, please comment or contact me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2008/03/28/vim-syntax-highlighting-for-google-gadgets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking MediaWiki External Links Statistics using Google Analytics</title>
		<link>http://www.guyrutenberg.com/2007/07/16/tracking-mediawiki-external-links-statistics-using-google-analytics/</link>
		<comments>http://www.guyrutenberg.com/2007/07/16/tracking-mediawiki-external-links-statistics-using-google-analytics/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 16:06:44 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://guy.sikumuna.com/2007/07/16/tracking-mediawiki-external-links-statistics-using-google-analytics/</guid>
		<description><![CDATA[When you track MediaWiki statistics, you usually track only internal page statistics, but tracking external links which leads out of your site is not some thing you can ignore. Unfortunately we probably can&#8217;t put actual tracking code in the pages linked to by our site&#8217;s external links. Fortunately we can track the actual clicks on [...]]]></description>
			<content:encoded><![CDATA[<p>When you track MediaWiki statistics, you usually track only internal page statistics, but tracking external links which leads out of your site is not some thing you can ignore. Unfortunately we probably can&#8217;t put actual tracking code in the pages linked to by our site&#8217;s external links. Fortunately we can track the actual clicks on those links that lead out of the site, and it&#8217;s quite easy to do when tracking statistics with Google Analytics. If you don&#8217;t already use Google Analytics with your MediaWiki site, open a new account in Google Analytics and see my previous post: <a href="/2007/07/13/track-mediawiki-statistics-using-google-analytics/">Track MediaWiki Statistics using Google Analytics</a>.</p>
<p><span id="more-7"></span>Now we two possible ways to add the tracking code to each external link. The first one is to hack the MediaWiki internal parser for wiki code to generate additional code for each link. While this way will probably work the best it&#8217;s pretty complicated and not straightforward. The other way, which is the one will follow, is to use a small JavaScript snippet which will will iterate through the links in every page and add an &#8220;onClick&#8221; attribute to them with the tracking code.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #003366; font-weight: bold;">var</span> links <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> links.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>links<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">className</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;external text&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                addtrackcode<span style="color: #009900;">&#40;</span>links<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> addtrackcode<span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        obj.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'onClick'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;javascript:urchinTracker('/outgoing/&quot;</span><span style="color: #339933;">+</span> obj.<span style="color: #660066;">href</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;://&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;');&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>This code snippet should go between you Google Analytics code and the<code> &lt;/body&gt;</code> tag, meaning you can add it to <code>/wiki/skins/monobook.php</code> if you haven&#8217;t changed the default skin for your MediaWiki. After the code is in place it may take up to 48 hours (usually you don&#8217;t have to wait at all) for the external links statistics to show up in the Google Analytics. In the Google Analytics the statistics for clicking on an external link which leads to <a href="http://www.google.com">http://www.google.com</a> will show up as view of the page /outgoing/www.google.com. This script will also track download statistics of files which are linked from the wiki pages (like pdf&#8217;&#8217;s and such).</p>
<p>While this code does the job, it has a drawbacks. It only tracks the external links created by wiki code (e.g. <code>[http://example.com]</code>) as it uses CSS classes to determine what is external link. However this drawback isn&#8217;t very important and overall the script does a decent job tracking the external links in MediaWiki using Google Analytics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2007/07/16/tracking-mediawiki-external-links-statistics-using-google-analytics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Track MediaWiki Statistics using Google Analytics</title>
		<link>http://www.guyrutenberg.com/2007/07/13/track-mediawiki-statistics-using-google-analytics/</link>
		<comments>http://www.guyrutenberg.com/2007/07/13/track-mediawiki-statistics-using-google-analytics/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 05:53:17 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://guy.sikumuna.com/2007/07/13/track-mediawiki-statistics-using-google-analytics/</guid>
		<description><![CDATA[Google Analytics is one of the best free web-statistics services available. It&#8217;s also quite easy to use with MediaWiki. To install Google Analytics in you MediaWiki you should put the tracking code, which is something that looks like:

&#60;script src=&#34;http://www.google-analytics.com/urchin.js&#34; type=&#34;text/javascript&#34;&#62;
&#60;/script&#62;
&#60;script type=&#34;text/javascript&#34;&#62;
_uacct=&#34;UA-xxxx-x&#34;;
urchinTracker&#40;&#41;;
&#60;/script&#62;

in every page, preferably just above the &#60;/body&#62; tag. The best way to do so [...]]]></description>
			<content:encoded><![CDATA[<p>Google Analytics is one of the best free web-statistics services available. It&#8217;s also quite easy to use with MediaWiki. To install Google Analytics in you MediaWiki you should put the tracking code, which is something that looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;script src=&quot;http://www.google-analytics.com/urchin.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
_uacct<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;UA-xxxx-x&quot;</span><span style="color: #339933;">;</span>
urchinTracker<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>in every page, preferably just above the &lt;/body&gt; tag. The best way to do so will be to put the tracking code inside the base skin php file. That means that unless you changed the default skin for MediaWiki you need to edit <code>/wiki/skins/MonoBook.php</code>. In this file you will find the &lt;/body&gt; tag towards the bottom of the file. Insert the tracking code just above it, save the file, and you&#8217;re done, as all pages will now show the script. Google Analytics will start gathering statistics usually in about 24-28 hours.</p>
<p>Update:<br />
If you also want to track external links to files and other websites take a look at<br />
<a href="/2007/07/16/tracking-mediawiki-external-links-statistics-using-google-analytics/">Tracking Mediawiki External Links Statistics Using Google Analytics</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2007/07/13/track-mediawiki-statistics-using-google-analytics/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.693 seconds -->
