Class: Gabrake::Collector
- Inherits:
-
Object
- Object
- Gabrake::Collector
- Defined in:
- lib/gabrake/collector.rb
Defined Under Namespace
Classes: Event
Constant Summary collapse
- URL =
'http://www.google-analytics.com/collect'
Class Method Summary collapse
Class Method Details
.event_for(exception, context) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gabrake/collector.rb', line 5 def self.event_for(exception, context) event = Event.new(exception) unless Gabrake.tracking_id raise ArgumentError.new('You need to specify Google Analytics Tracking ID in `Gabrake.tracking_id\'') end params = { v: context[:version], dl: CGI::escape(context[:url]), cid: context[:client_id], tid: Gabrake.tracking_id, t: :event, ec: event.category, ea: event.action, el: event.label } params[:"cd#{Gabrake.custom_dimension_index}"] = Gabrake.tracked_version if Gabrake.custom_dimension_index "#{URL}?#{params.map { |key, value| "#{key}=#{value}" }.join('&') }" end |