<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/rugalytics/rugrat.user.js</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -6,6 +6,7 @@ lib/rugalytics/item.rb
 lib/rugalytics/profile.rb
 lib/rugalytics/report.rb
 lib/rugalytics/server.rb
+lib/rugalytics/rugrat.user.js
 lib/rugalytics.rb
 LICENSE
 Manifest</diff>
      <filename>Manifest</filename>
    </modified>
    <modified>
      <diff>@@ -234,6 +234,41 @@ automatically, e.g.:
  top_items_over_week = report.items.sort_by{|i| i.unique_pageviews.to_i}.reverse
 
 
+==Rugalytics on Rugrat - a Greasemonkey script for Firefox
+
+TO INSTALL:
+
+Create a rugalytics.yml config file containing:
+
+ ---
+ account: your_account_name
+ profile: your_profile_name
+ username: your_user_name
+ password: your_pass_w
+
+
+Run rugalytics executable on console in same directory as rugalytics.yml:
+
+ &gt; rugalytics
+
+
+Add Greasemonkey to Firefox: https://addons.mozilla.org/firefox/748/
+
+Go to: http://localhost:8888/
+
+Add rugrat user script: http://localhost:8888/rugrat.user.js
+
+Configure site for rugrat to run on:
+
+ Tools -&gt; Greasemonkey -&gt; Manage User Scripts
+ -&gt; select rugrat -&gt; press &quot;Add&quot;
+ -&gt; add your site, e.g. http://your_site.com/*
+ -&gt; press &quot;Close&quot;
+
+Browse your site!
+
+
+
 ==Acknowledgements
 
 Rugalytics started life as a fork of jnunemaker's Statwhore. As the code and</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -234,6 +234,41 @@ automatically, e.g.:
  top_items_over_week = report.items.sort_by{|i| i.unique_pageviews.to_i}.reverse
 
 
+==Rugalytics on Rugrat - a Greasemonkey script for Firefox
+
+TO INSTALL:
+
+Create a rugalytics.yml config file containing:
+
+ ---
+ account: your_account_name
+ profile: your_profile_name
+ username: your_user_name
+ password: your_pass_w
+
+
+Run rugalytics executable on console in same directory as rugalytics.yml:
+
+ &gt; rugalytics
+
+
+Add Greasemonkey to Firefox: https://addons.mozilla.org/firefox/748/
+
+Go to: http://localhost:8888/
+
+Add rugrat user script: http://localhost:8888/rugrat.user.js
+
+Configure site for rugrat to run on:
+
+ Tools -&gt; Greasemonkey -&gt; Manage User Scripts
+ -&gt; select rugrat -&gt; press &quot;Add&quot;
+ -&gt; add your site, e.g. http://your_site.com/*
+ -&gt; press &quot;Close&quot;
+
+Browse your site!
+
+
+
 ==Acknowledgements
 
 Rugalytics started life as a fork of jnunemaker's Statwhore. As the code and</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -94,6 +94,9 @@ module Rugalytics
         params[:seg] = '1'
         params[:segkey] = options[:segment] ? options[:segment] : 'organization'
       end
+      if options[:value]
+        params[:gval] = options[:value]
+      end
       params
     end
 </diff>
      <filename>lib/rugalytics/profile.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,25 +10,58 @@ module Rugalytics
 
     def call(env)
       path = env['PATH_INFO'].tr('/','')
-      request = Rack::Request.new(env)
-      report_name = (path + '_report').to_sym
-      send_data(report_name, request.GET.symbolize_keys)
+
+      if path.empty?
+        html = %Q|
+        &lt;h1&gt;Rugalytics on Rugrat&lt;/h1&gt;
+        &lt;p&gt;TO INSTALL:&lt;/p&gt;
+        &lt;p&gt;Add Greasemonkey to Firefox: &lt;a href=&quot;https://addons.mozilla.org/firefox/748/&quot;&gt;https://addons.mozilla.org/firefox/748/&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;Add rugrat user script: &lt;a href=&quot;http://localhost:8888/rugrat.user.js&quot;&gt;rugrat.user.js&lt;/a&gt;&lt;/p&gt;
+        &lt;p&gt;Configure site for rugrat to run on:&lt;/p&gt;
+        &lt;p&gt;&lt;code&gt;Tools -&amp;gt; Greasemonkey -&amp;gt; Manage User Scripts&lt;/code&gt;&lt;br/&gt;
+        &lt;code&gt;-&amp;gt; select rugrat -&amp;gt; press &quot;Add&quot; -&amp;gt; add your site, e.g. http://your_site.com/* -&amp;gt; press &quot;Close&quot;&lt;/code&gt;&lt;/p&gt;
+        &lt;p&gt;Create a rugalytics.yml config file containing:&lt;/p&gt;&lt;pre&gt;
+---
+account: your_account_name
+profile: your_profile_name
+username: your_user_name
+password: your_pass_w
+
+&lt;/pre&gt;
+        &lt;p&gt;Run rugalytics on console in same directory as rugalytics.yml:&lt;/p&gt;
+        &lt;p&gt;&lt;code&gt;&amp;gt; rugalytics&lt;/code&gt;&lt;/p&gt;
+        &lt;p&gt;Browse your site!&lt;/p&gt;|
+        [200, {'Content-Type' =&gt; &quot;text/html&quot;}, html]
+      elsif path == 'rugrat.user.js'
+        [200, {'Content-Type' =&gt; &quot;application/json&quot;}, File.new(File.dirname(__FILE__)+'/rugrat.user.js').readlines ]
+      else
+        request = Rack::Request.new(env)
+        report_name = (path + '_report').to_sym
+        send_data(report_name, request.GET.symbolize_keys)
+      end
     end
 
     def send_data report_name, params
       key = (params.values &lt;&lt; report_name).join('')
       @reports[key] ||= @profile.send(report_name, params)
       report = @reports[key]
+
       json = report.attributes.to_json
-      json = add_in_front params, json
-      json = add_in_front({:report_name =&gt; report.name}, json)
+      add_in_front params, json
+      report.attribute_names.each do |name|
+        if name[/(.*)pageviews_graph/]
+          total = &quot;#{$1}pageviews_total&quot;.to_sym
+          add_in_front({total =&gt; report.send(total)}, json)
+        end
+      end
+      add_in_front({:report_name =&gt; report.name}, json)
 
       [200, {'Content-Type' =&gt; &quot;application/json&quot;}, json ]
     end
 
     private
       def add_in_front hash, json
-        json.sub('{', hash.to_json.chomp(&quot;}&quot;) + ', ' )
+        json.sub!('{', hash.to_json.chomp(&quot;}&quot;) + ', ' ) unless hash.empty?
       end
   end
 end</diff>
      <filename>lib/rugalytics/server.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b9c945aab1ad8f36dbaa06cbddd156de40b921e6</id>
    </parent>
  </parents>
  <author>
    <name>robmckinnon</name>
    <email>rob@theyworkforyou.co.nz</email>
  </author>
  <url>http://github.com/robmckinnon/rugalytics/commit/9d951b6c376022e9783c9341eb5fd6dc8e19977c</url>
  <id>9d951b6c376022e9783c9341eb5fd6dc8e19977c</id>
  <committed-date>2008-12-01T17:21:58-08:00</committed-date>
  <authored-date>2008-12-01T17:21:58-08:00</authored-date>
  <message>work for Rugalytics on Rugrat greasemonkey script</message>
  <tree>a88b39ec5c56d264eedc07535469a126b32c5840</tree>
  <committer>
    <name>robmckinnon</name>
    <email>rob@theyworkforyou.co.nz</email>
  </committer>
</commit>
