Skip to content
This repository has been archived by the owner on Apr 4, 2018. It is now read-only.

Commit

Permalink
Update names to the general ga collector.
Browse files Browse the repository at this point in the history
@author Johannes
  • Loading branch information
Johannes Thoenes committed Aug 13, 2012
1 parent aa2b3bc commit 41bf55d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
datainsight-visits-collector
============================

Collects visits data for different time intervals from google analytics
Collect the statics specified by the configuration from google analytics
11 changes: 6 additions & 5 deletions bin/collector
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# Collects the weekly visits.
# Run: './bin/collector -t TOKEN print'
# Collects the statistics from google analytics.
# Run: './bin/collector -t TOKEN -c ConfigName print' (the first time)
# Run: './bin/collector -c ConfigName print' (subsequent times)
#
# To obtain authorisation code please visit:
#
Expand All @@ -18,7 +19,7 @@ require_relative '../lib/config/weekly_unique_visitors'

include GLI

program_desc 'Collect the weekly visits'
program_desc 'Collect the statics specified by the configuration from google analytics'

version 0.1

Expand Down Expand Up @@ -47,15 +48,15 @@ end


command :print do |c|
c.desc 'Print out the collected content'
c.desc 'Print out the collected statistics'
c.action do |global_options, options, args|
puts collector(global_options).collect_as_json
end
end


command :broadcast do |c|
c.desc 'Publish the collected content to the queue'
c.desc 'Publish the collected statistics to the queue'
c.action do |global_options, options, args|
collector(global_options).broadcast
end
Expand Down
4 changes: 2 additions & 2 deletions lib/response.rb
Expand Up @@ -34,7 +34,7 @@ def parse_success(response)
{
:start_at => extract_start_at(response["query"]["start-date"]),
:end_at => extract_end_at(response["query"]["end-date"]),
:value => get_total_visits(response["rows"]),
:value => get_total_metric(response["rows"]),
:site => SITE_KEY
}
end
Expand All @@ -48,7 +48,7 @@ def extract_end_at(end_date)
end


def get_total_visits(rows)
def get_total_metric(rows)
rows.inject(0) { |total, row| total + row.last.to_i }
end
end
Expand Down

0 comments on commit 41bf55d

Please sign in to comment.