<?xml version="1.0"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>CKAN: Ticket #937: Record download stats for resources (extension)</title>
    <link>http://localhost/ticket/937</link>
    <description>&lt;p&gt;
As a User (especially as a Package &lt;a class="missing wiki"&gt;Owner/Maintainer?&lt;/a&gt;) I want to know how many times a resource has been downloaded (and when).
&lt;/p&gt;
&lt;p&gt;
So let's record download stats (as in clicks on the link for a resource).
&lt;/p&gt;
&lt;h2 id="Implementation"&gt;Implementation&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Use the existing support for this feature in google analytics or piwiki
&lt;/li&gt;&lt;li&gt;For google analytics see:
&lt;ul&gt;&lt;li&gt;Integrate to record: &lt;a class="ext-link" href="http://www.google.com/support/analytics/bin/answer.py?answer=55529"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://www.google.com/support/analytics/bin/answer.py?answer=55529&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;Accessing analytics data via API (for showing download counts): &lt;a class="ext-link" href="http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Limitations only record downloads by browsers with js turned on.
&lt;ul&gt;&lt;li&gt;This is OK I think (in any case machine download via e.g. datapkg does not get downloaded)
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 id="OldSpecdoitinCKAN"&gt;Old Spec (do it in CKAN)&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;Record info of form: resource id (or url?), timestamp
&lt;/li&gt;&lt;li&gt;Do this via javascript capturing of onclick event talking to an api
&lt;/li&gt;&lt;li&gt;API: /api/resource/{id}/download
&lt;ul&gt;&lt;li&gt;POST to increment (how do we stop spamming -- could use a nonce setup with a random string set on each page load for the js)
&lt;/li&gt;&lt;li&gt;GET to get data back { total: X, day_count: [ [yyyy-mm-dd, count], ... ] }
&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id="Questions"&gt;Questions&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Do we record ip addresses (to handle de-botting etc)?
&lt;/li&gt;&lt;li&gt;Do we count preview clicks as well?
&lt;/li&gt;&lt;/ul&gt;</description>
    <language>en-us</language>
    <image>
      <title>CKAN</title>
      <url>http://assets.okfn.org/p/ckan/img/ckan_logo_shortname.png</url>
      <link>http://localhost/ticket/937</link>
    </image>
    <generator>Trac 0.12.3</generator>
    <item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Sun, 30 Jan 2011 10:57:22 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/937#comment:1</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:1</guid>
      <description>
        &lt;p&gt;
Could consider using third-party analytics tracking here, which will also give referrer etc data for free?
&lt;/p&gt;
&lt;p&gt;
Would probably be bes provided in the form of optional piwik or google analytics integration.  Being able to say in the UI how many downloads there have been would need piwik.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>rgrp</dc:creator>

      <pubDate>Mon, 14 Feb 2011 10:37:40 GMT</pubDate>
      <title>description, milestone changed; keywords, owner set</title>
      <link>http://localhost/ticket/937#comment:2</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:2</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;keywords&lt;/strong&gt;
              &lt;em&gt;extension&lt;/em&gt; &lt;em&gt;contributor&lt;/em&gt; &lt;em&gt;simple&lt;/em&gt; &lt;em&gt;js&lt;/em&gt; added
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;owner&lt;/strong&gt;
              set to &lt;em&gt;rgrp&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;description&lt;/strong&gt;
              modified (&lt;a href="/ticket/937?action=diff&amp;amp;version=2"&gt;diff&lt;/a&gt;)
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                changed from &lt;em&gt;ckan-v1.4&lt;/em&gt; to &lt;em&gt;ckan-v1.4-sprint-2&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 14 Feb 2011 13:23:01 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/937#comment:3</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:3</guid>
      <description>
        &lt;p&gt;
I did a very quick hacky thing at the end of last week on top of the "insert google analytics code" extension we discussed, to work out "most popular packages" based off data harvested from the Google Analytics API.  Needs making generic, tests etc but could be a starting point:
&lt;a class="ext-link" href="https://bitbucket.org/sebbacon/ckanext-googleanalytics/src"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://bitbucket.org/sebbacon/ckanext-googleanalytics/src&lt;/a&gt;
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 14 Feb 2011 13:24:19 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/937#comment:4</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:4</guid>
      <description>
        &lt;p&gt;
(and it would also need some proper caching as the GA API is very slow)
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 28 Feb 2011 11:08:15 GMT</pubDate>
      <title>owner, status, milestone changed</title>
      <link>http://localhost/ticket/937#comment:5</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:5</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;owner&lt;/strong&gt;
              changed from &lt;em&gt;rgrp&lt;/em&gt; to &lt;em&gt;sebbacon&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;new&lt;/em&gt; to &lt;em&gt;assigned&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                changed from &lt;em&gt;ckan-v1.4-sprint-2&lt;/em&gt; to &lt;em&gt;ckan-v1.4-sprint-3&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 28 Feb 2011 11:29:07 GMT</pubDate>
      <title></title>
      <link>http://localhost/ticket/937#comment:6</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:6</guid>
      <description>
        &lt;p&gt;
The current implementation I referenced above will be a good starting point.
&lt;/p&gt;
&lt;p&gt;
Work that remains:
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Add download click tracking to individual download links (currently we just record page views for packages, not downloads)
&lt;/li&gt;&lt;li&gt;Somehow cache the download stats against each package (the Google API is very slow); package reddis or sqlite or similar as a local storage for the extension
&lt;/li&gt;&lt;li&gt;Expose download information in the relevant places in the UI (all users? package owners? where?)
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;
This is about 2 days' work.  Unlikely to get it done in this sprint.
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 21 Mar 2011 10:34:39 GMT</pubDate>
      <title>milestone changed; repo, theme set</title>
      <link>http://localhost/ticket/937#comment:7</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:7</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;repo&lt;/strong&gt;
                set to &lt;em&gt;ckan&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;theme&lt;/strong&gt;
                set to &lt;em&gt;none&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                changed from &lt;em&gt;ckan-v1.4-sprint-3&lt;/em&gt; to &lt;em&gt;ckan-v1.4-sprint-4&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 28 Mar 2011 09:40:24 GMT</pubDate>
      <title>milestone changed</title>
      <link>http://localhost/ticket/937#comment:8</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:8</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;milestone&lt;/strong&gt;
                changed from &lt;em&gt;ckan-v1.4-sprint-4&lt;/em&gt; to &lt;em&gt;ckan-v1.4-sprint-5&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
      </description>
      <category>Ticket</category>
    </item><item>
      
        <dc:creator>sebbacon</dc:creator>

      <pubDate>Mon, 11 Apr 2011 09:23:51 GMT</pubDate>
      <title>status changed; resolution set</title>
      <link>http://localhost/ticket/937#comment:9</link>
      <guid isPermaLink="false">http://localhost/ticket/937#comment:9</guid>
      <description>
          &lt;ul&gt;
            &lt;li&gt;&lt;strong&gt;status&lt;/strong&gt;
                changed from &lt;em&gt;assigned&lt;/em&gt; to &lt;em&gt;closed&lt;/em&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;strong&gt;resolution&lt;/strong&gt;
                set to &lt;em&gt;fixed&lt;/em&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;p&gt;
Completed; software at &lt;a class="ext-link" href="https://bitbucket.org/okfn/ckanext-googleanalytics/src"&gt;&lt;span class="icon"&gt;​&lt;/span&gt;https://bitbucket.org/okfn/ckanext-googleanalytics/src&lt;/a&gt;
&lt;/p&gt;
      </description>
      <category>Ticket</category>
    </item>
 </channel>
</rss>