cartodb/lib/carto/tracking/services/segment.rb

21 lines
495 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
module Carto
module Tracking
module Services
module Segment
def report_to_segment
return unless segment_api_key
segment_job = Resque::TrackingJobs::SendSegmentEvent
supplied_properties = @format.to_segment
Resque.enqueue(segment_job, @reporter.try(:id), name, supplied_properties)
end
def segment_api_key
@segment_api_key ||= Cartodb.get_config(:segment, 'api_key')
end
end
end
end
end