Module: FacebookApp::TrackingHelper

Included in:
TrackingsController
Defined in:
lib/facebook_app/tracking_helper.rb

Instance Method Summary collapse

Instance Method Details

#begin_trackingObject



4
5
6
7
# File 'lib/facebook_app/tracking_helper.rb', line 4

def begin_tracking
  conversion = Conversion.find_or_create(cookies[:conversion_id],params[:marketing_mode])
  cookies[:conversion_id] = conversion.id
end

#track_conversion(conversion_state) ⇒ Object



9
10
11
12
13
14
# File 'lib/facebook_app/tracking_helper.rb', line 9

def track_conversion(conversion_state)
  Rails.logger.info "Attempting to track #{conversion_state} with cookie #{cookies[:conversion_id]}"
  Conversion.track(cookies[:conversion_id], conversion_state)
rescue
  Rails.logger.info "Failed to track #{conversion_state}. Error with logging"
end