Fosome / garb

A Ruby wrapper for the Google Analytics API
http://www.viget.com/extend/
654 stars 89 forks source link

Access via Simple API Access Key #112

Open robj opened 12 years ago

robj commented 12 years ago

Is this possible? To use the 'Key for browser apps (with referers)'

I dont want to use oauth as I want reports created on behalf of users automatically, not users interacting with OAuth.

The Username/Password combo is fickle, as invalid login attempts for google analytics website can result in blocking API access.

sat commented 12 years ago

Quick fix, put this in an initialiser.

module Garb
  module Request
    class Data
      def query_string
        @parameters.merge!("key" => "PUT API KEY HERE")
        parameter_list = @parameters.map {|k,v| "#{k}=#{v}" }
        parameter_list.empty? ? '' : "?#{parameter_list.join('&')}"
      end
    end
  end
end
erictarn commented 12 years ago

Is there a way to do this now without monkey patching? I think you need an API key now to increase your limits.