How do I track API calls on my ruby ββin a rails app using google analytics?
2 answers
You can send events using a 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"})
+5
source to share
I believe you can do this in Google Events:
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
There are various Ruby libraries for interacting with GA.
-1
source to share