<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">

<channel>
<title>Hackszine: Web Site Measurement</title>
<link>http://www.hackszine.com/blog/archive/web_site_measurement/</link>
<description>O&apos;Reilly&apos;s Hacks Series reclaims the term &apos;hacking&apos; for the good guys--innovators who explore and experiment, unearth shortcuts, create useful tools, and come up with fun things to try on their own</description>
<language>en-us</language>
<copyright>Copyright 2008, O'Reilly Media, Inc.</copyright>
<lastBuildDate>Wed, 28 May 2008 19:44:20 -0800</lastBuildDate>
<pubDate>Sun, 20 Jul 2008 21:57:00 -0800</pubDate>
<generator>http://www.movabletype.org/?v=4.1</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<itunes:author>O'Reilly Media, Inc.</itunes:author>
<itunes:subtitle>Clever solutions to interesting problems.</itunes:subtitle>
<itunes:summary>Hackszine Podcast</itunes:summary>
<itunes:owner>
<itunes:email>webmaster@makezine.com</itunes:email>
</itunes:owner>
<category>Technology</category>
<itunes:category text="Technology">
</itunes:category>
<itunes:category text="Technology">
  <itunes:category text="Gadgets" />
</itunes:category>
<itunes:category text="Games &amp; Hobbies" >
</itunes:category>
<itunes:category text="Science">
</itunes:category>
<itunes:image href="http://makezine.com/images/hackszine/rss_icon.jpg" />
<itunes:explicit>no</itunes:explicit>


<item>
<title>Detect which sites a web user visits</title>
<itunes:summary> Aza Raskin&apos;s SocialHistory Javascript library allows you to do something incredibly cool: detect which sites your web users have visited on a per-user basis. The javascript runtime isn&apos;t supposed to be privy to the information in a user&apos;s browser...</itunes:summary>
<description>
<![CDATA[<p><span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="socialdetect_20080528.jpg" src="http://www.hackszine.com/socialdetect_20080528.jpg" width="500" height="147" class="mt-image-none" style="" /></span></p>

<p>Aza Raskin's SocialHistory Javascript library allows you to do something incredibly cool: detect which sites your web users have visited on a per-user basis. The javascript runtime isn't supposed to be privy to the information in a user's browser history, but there's an information backchannel common to all major browsers which allows you to effectively interrogate the browsing history and determine if a particular URL has been visited before. </p>

<p>It works by creating an anchor link to the site in question and applying a CSS style to the link, specifying a different display property for "a:visited". By reading the computed style back from the anchor element, you can then determine the property's value, and consequently if the user had visited the URL or not.</p>

<p>This could probably be used for a number of devious purposes, but Aza's concept for the SocialHistory library is actually really useful. By querying the default URLs that belong to all the major social network sites, you can figure out which sites a particular user visits and custom tailor any social badges that you display. If they use del.icio.us, you show a del.icio.us link.  If they visit Digg, you show the Digg button. It's an awesome feature made possible by a pretty freaky security leak.</p>

<p>Now, it's not perfect. It requires that you query the exact URLs that a user may have visited. You can't figure out everywhere they've been, how frequently, or in what order, only whether a particular URL that you know about has been visited before. On the other hand, it's a pretty useful tool considering you aren't even supposed to be able to do this.</p>

<p><a href="http://azarask.in/blog/post/socialhistoryjs/">How to Detect the Social Sites Your Visitors Use</a><br />
<a href="http://code.google.com/p/aza/source/browse/trunk/SocialHistory/SocialHistory.js">SocialHistory.js</a></p>]]>
[&lt;a href="http://www.hackszine.com/blog/archive/2008/05/detect_which_sites_a_web_user.html?CMP=OTC-7G2N43923558" /&gt;Read More&lt;/a&gt;]  
[&lt;a href="http://www.hackszine.com/blog/archive/2008/05/detect_which_sites_a_web_user.html?CMP=OTC-7G2N43923558#comments" /&gt;Comments&lt;/a&gt;]
</description>
<link>http://www.hackszine.com/blog/archive/2008/05/detect_which_sites_a_web_user.html?CMP=OTC-7G2N43923558</link>
<guid>http://www.hackszine.com/blog/archive/2008/05/detect_which_sites_a_web_user.html?CMP=OTC-7G2N43923558</guid>
<category>Ajax</category>
<pubDate>Wed, 28 May 2008 19:44:20 -0800</pubDate>

</item>

<item>
<title>Server-side Google Analytics</title>
<itunes:summary>Peter van der Graaf did a little analysis of the URLs that are generated by the Google Analytics Javascript API and put together a very useful tutorial for building Analytics-enabled applications without the use of Javascript. When you look at...</itunes:summary>
<description>
<![CDATA[<p>Peter van der Graaf did a little analysis of the URLs that are generated by the Google Analytics Javascript API and put together a very useful tutorial for building Analytics-enabled applications without the use of Javascript.</p>

<blockquote>When you look at the analytics javascript code you see that it combines several sets of data into an image request. This image request sends the right data to Google (not the javascript). When you know what url you should use for the image, you can call the image directly and send the same data. Of course you need to be able to request the image url and that isn't easy from another image, rss feed or pdf. This is why we request it "server side".</blockquote>

<p>You can add the code to the PHP that drives a blog site, for instance, and generate page views when your RSS feed is hit.  You can even write a very simple script to proxy images and downloads, which will let you track hit data for all files on your site, not just the html pages viewed by a javascript enabled browser.</p>

<p>Taken a step further, you could even use this on the client side, triggering analytics views from standalone Flash apps or even desktop applications.</p>

<p>The one thing you need to keep in mind is that server-side analytics requests will appear to come from your server, not the client's machine. So while you can track page views and download events this way, you'll loose a lot of the information about your user base.  Because of this, it would probably make sense to use a separate tracking ID for the server side events.</p>

<p><a href="http://www.vdgraaf.info/google-analytics-without-javascript.html">Google Analytics Without Javascript</a> </p>]]>
[&lt;a href="http://www.hackszine.com/blog/archive/2008/05/serverside_google_analytics.html?CMP=OTC-7G2N43923558" /&gt;Read More&lt;/a&gt;]  
[&lt;a href="http://www.hackszine.com/blog/archive/2008/05/serverside_google_analytics.html?CMP=OTC-7G2N43923558#comments" /&gt;Comments&lt;/a&gt;]
</description>
<link>http://www.hackszine.com/blog/archive/2008/05/serverside_google_analytics.html?CMP=OTC-7G2N43923558</link>
<guid>http://www.hackszine.com/blog/archive/2008/05/serverside_google_analytics.html?CMP=OTC-7G2N43923558</guid>
<category>Google</category>
<pubDate>Thu, 01 May 2008 20:27:10 -0800</pubDate>

</item>

<item>
<title>Automatic outbound link analytics with jQuery</title>
<itunes:summary>I had the challenge of adding Google Analytics tracking code to all the outbound links on a site I&apos;ve been working on. There are hundreds of these links scattered around the site, so rather than try and edit a bunch...</itunes:summary>
<description>
<![CDATA[<p>I had the challenge of adding Google Analytics tracking code to all the outbound links on a site I've been working on.  There are hundreds of these links scattered around the site, so rather than try and edit a bunch of links, manually adding onclick handlers in an error-prone fashion, I decided to get lazy and write some code to handle it for me.</p>

<p>First I was thinking about doing some sort of regular expression search and replace throughout the site and database, but that reminded me of CSS3 selectors and their ability to do simple pattern matching. I've seen people apply a special style to outbound links this way, so after a few minutes of monkeying around with things, I now have a chunk of jQuery that will automatically track clicks on all outbound links.</p>

<p>Here it is, in a nutshell:</p>

<blockquote><code>
jQuery(function($){

<p>&nbsp;&nbsp;  // Match all anchor tags in the "maincontent" div with<br />
&nbsp;&nbsp;  // urls that begin with "http" but don't contain the<br />
&nbsp;&nbsp;  // string "yourwebsite.com"<br />
&nbsp;&nbsp;  $('#maincontent a[href^="http"]').not('a[href*="yourwebsite.com"]').click(function(){</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;     try {</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;        // Get the href url and toss out the "http://"<br />
&nbsp;&nbsp;&nbsp;&nbsp;        var href = $(this).attr('href');<br />
&nbsp;&nbsp;&nbsp;&nbsp;       if ( href.indexOf("://") &gt; 0 ) {</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             // Track the page in Google Analytics as <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             // "/tracking/outbound/www.somesite.com/foo"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             var outbound = '/tracking/outbound/' + href.split("://",2)[1];<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             pageTracker._trackPageview(outbound);</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        }<br />
&nbsp;&nbsp;&nbsp;&nbsp;     } catch( e ) {}<br />
&nbsp;&nbsp;  }<br />
}<br />
</code></blockquote></p>

<p>With this running, all of my internal pages get tracked as usual, and any external links will appear as pageviews that look like "/tracking/outbound/www.somesite.com/foo".</p>

<p>If you link out to many different pages on several sites, keeping the full site url in the tracking code and building these deep paths is particularly useful.  Google Analytics will allow you to drill down into the tree like it was normal content and quickly pull numbers on how many total outbound clicks you received (/tracking/outbound), how many went to www.somesite.com (/tracking/outbound/www.somesite.com), and how many people clicked out to a particular page on the site.</p>

<p>This saved me quite a bit of time and is immensely more flexible than any other outbound tracking method I've used.  I hope this helps someone else.  Drop me a line in the comments if this works out for you.</p>

<p><strong>Update:</strong> it looks like I wasn't the first to do this. <a href="http://blog.rebeccamurphey.com/2008/01/06/track-outbound-clicks-with-google-analytics-and-jquery/">An article by Rebecca Murphey</a> shows how to do something similar, while also adding the referring post title to the tracking code.  Pretty cool stuff, I must say.</p>]]>
[&lt;a href="http://www.hackszine.com/blog/archive/2008/04/automatic_outbound_link_analyt.html?CMP=OTC-7G2N43923558" /&gt;Read More&lt;/a&gt;]  
[&lt;a href="http://www.hackszine.com/blog/archive/2008/04/automatic_outbound_link_analyt.html?CMP=OTC-7G2N43923558#comments" /&gt;Comments&lt;/a&gt;]
</description>
<link>http://www.hackszine.com/blog/archive/2008/04/automatic_outbound_link_analyt.html?CMP=OTC-7G2N43923558</link>
<guid>http://www.hackszine.com/blog/archive/2008/04/automatic_outbound_link_analyt.html?CMP=OTC-7G2N43923558</guid>
<category>Ajax</category>
<pubDate>Fri, 11 Apr 2008 22:57:30 -0800</pubDate>

</item>

<item>
<title>Show Full Referring Source in Google Analytics</title>
<itunes:summary> If you use Google Analytics and you&apos;ve ever tried to determine what URLs are referring to your site, you may have noticed that the report only includes the file name portion of the URL, excluding the query string. If...</itunes:summary>
<description>
<![CDATA[<p><img alt="analyticsreferrer_20070410.jpg" src="http://hackszine.com/analyticsreferrer_20070410.jpg" width="500" height="327" /><br />
If you use Google Analytics and you've ever tried to determine what URLs are referring to your site, you may have noticed that the report only includes the file name portion of the URL, excluding the query string.  If your referrers are dynamic forums and bulletin boards, this makes it impossible to tell what message or thread has linked to your site.  All you may see are a bunch of referrals from "/forums/viewtopic.php" since the full article path is encoded in the query string.</p>

<p>Reuben Yau came up with a nice hack that solves the full-referrer problem.  The hack uses urchin's manual javascript tracking mechanism, typically used to track flash events, to register a page view with the full referring URL as the title.  Just update your tracking code with the following:</p>

<p><code>&lt;script src="http://www.google-analytics.com/urchin.js" type="text/javascript"&gt;<br />
&lt;/script&gt;<br />
&lt;script type="text/javascript"&gt;<br />
_uacct = "UA-XXXXXX-X";<br />
urchinTracker();<br />
urchinTracker(document.referrer);<br />
&lt;/script&gt;</code></p>

<p>After you've made the change, you'll start seeing referring URLs showing up in the main content reports (as opposed to the "referring source/cross segment performance/content" report).  They'll look a little different from typical content, as the content name will contain a full http:// URL.  You can then filter the report for "http:" if you only want to view the referrer data.</p>

<p>Google Analytics Full Referrer Tracking -<a href="http://www.reubenyau.com/google-analytics-full-referrer-tracking-update/">Link.</a></p>]]>
[&lt;a href="http://www.hackszine.com/blog/archive/2007/04/show_full_referring_source_in.html?CMP=OTC-7G2N43923558" /&gt;Read More&lt;/a&gt;]  
[&lt;a href="http://www.hackszine.com/blog/archive/2007/04/show_full_referring_source_in.html?CMP=OTC-7G2N43923558#comments" /&gt;Comments&lt;/a&gt;]
</description>
<link>http://www.hackszine.com/blog/archive/2007/04/show_full_referring_source_in.html?CMP=OTC-7G2N43923558</link>
<guid>http://www.hackszine.com/blog/archive/2007/04/show_full_referring_source_in.html?CMP=OTC-7G2N43923558</guid>
<category>Web Site Measurement</category>
<pubDate>Tue, 10 Apr 2007 18:52:50 -0800</pubDate>

</item>


</channel>
</rss>