How to track API calls on my ruby on rails app using google analytics?
You could send the events with the measurement protocol.
require "net/http"
require "uri"
uri = URI.parse("http://www.google-analytics.com/collect")
Net::HTTP.post_form(uri, {"v" => "1",
"tid" => "UA-XXXX-1",
"cid" => "555",
"t" => "event",
"ec" => "API",
"ea" => "request",
"el" => "data/get",
"ev" => "5"})
Integrate Google Analytics Dashboard in Rails
It's a Javascript library, so you would create new a view and paste some HTML and JS into it. You'll have to make sure it works with your application layout. The Embed API - Getting Started guide shows the code to get a dashboard up and running.
Google Analytics API and Rails
I just needed to give permission to the 123@developer.gservice...
on the
Manage > User Management tab
How can I incorporate Google Analytics results into my Rails 3 app?
Check out the GARB library http://www.viget.com/extend/google-analytics-api-with-ruby-and-garb-making-it-even-easier/
Code from their site:
profile = Garb::Profile.first('UA-XXXXXX-XX')
class Pageviews
extend Garb::Resource
metrics :pageviews
end
# Now get those pageviews!
profile.pageviews
Related Topics
Ruby on Rails View Rendering Db Info on Page
How to Strip Commas from Float Input
Require Self Made Gem in Jruby Fails After Update to Jruby-1.7.13
If Referer = "/Search", Do X, Else Do Y: "Bad Argument (Expected Uri Object or Uri String)"
Multiple Limit Condition in Mongodb
Pow Not Loading Gem Properly While Rails S Works
Delete from Database with Specific Details in Ruby
Mongomapper Many to Many Issue with Array
Create and Initialize Instances of a Class with Sequential Names
Ruby Stack Failed to Deploy on Google Developers Console
Metasploit Induction of Bundle and Rake
Is There a Way of Changing Regular Expressions to a Range of Numbers in Ruby on Rails
Ruby Selenium Web Drive: How to Find Specific Element by Xpath Div Id and CSS Class
Does Ruby Provide a Constant_Added Hook Method
How to Use 'Debugger' and 'Pry' When Developing a Gem? (Ruby)