module Rack::Deduce::Ingest::Helpers

Public Instance Methods

deduce_event_post(event, email, additional = {}, options = {}) click to toggle source

Sends an event to Deduce

@param [String] event The event type @param [String] email The user's email address @param [Hash] additional @param [Hash] options

# File lib/rack/deduce/ingest/helpers.rb, line 32
def deduce_event_post(event, email, additional = {}, options = {})
  additional[:session_id] = session.id unless additional.has_key? :session_id
  additional[:url]        ||= request.original_url
  additional[:user_agent] ||= request.headers['User-Agent']

  html = Rack::Deduce::Ingest.event email, request.remote_ip, event, additional, options
  html = html.html_safe if html.respond_to :html_safe
  html
end
deduce_ingest_html(email, options = {}) click to toggle source

Outputs the Deduce ingest Javascript code. A cookie is set indicating the user has been collected from

As this helper outputs HTML tags, when used in Rails it must be marked HTML safe before being written to the page.

@param [String] email The user's email address @param [Hash] options @option options [String] :site_id @option options [Boolean] :ssl

# File lib/rack/deduce/ingest/helpers.rb, line 22
def deduce_ingest_html(email, options = {})
  Rack::Deduce::Ingest.html email, options
end