Class: GoogleAnalyticsEventsService
- Inherits:
-
Object
- Object
- GoogleAnalyticsEventsService
- Defined in:
- app/services/google_analytics_events_service.rb
Overview
developers.google.com/analytics/devguides/collection/protocol/v1/devguide v=1 // Version. &tid=UA-XXXXX-Y // Tracking ID / Property ID. &cid=555 // Anonymous Client ID. &t=event // Event hit type &ec=video // Event Category. Required. &ea=play // Event Action. Required. &el=holiday // Event label. &ev=300 // Event value.
Class Method Summary collapse
Class Method Details
.send_event(params = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/services/google_analytics_events_service.rb', line 14 def self.send_event(params={}) params["v"] = 1 params["tid"] = Rails.application.secrets.ga_id params["aip"] = 1 params["t"] = "event" uri = URI.parse("http://www.google-analytics.com/collect") res = Net::HTTP.post_form(uri, params) end |