Created
November 8, 2010 01:32
-
-
Save davidjrice/667272 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'garb' | |
require 'fastercsv' | |
ga = Garb::Session.login('USERNAME', 'PASSWORD') | |
Garb::Account.all.each do |account| | |
profile = account.profiles.first | |
report = Garb::Report.new(profile) | |
report.metrics :pageviews, :exits | |
report.dimensions :page_path | |
report.sort :exits | |
FasterCSV.open("./#{account.name}.csv", "w") do |csv| | |
csv << ["page path", "pageviews","exits"] | |
report.results.each do |r| | |
csv << [r.page_path, r.pageviews, r.exits] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment