Module: Rack::Deduce::Ingest::Helpers
- Defined in:
- lib/rack/deduce/ingest/helpers.rb
Instance Method Summary collapse
-
#deduce_event_post(event, email, additional = {}, options = {}) ⇒ Object
Sends an event to Deduce.
-
#deduce_ingest_html(email, options = {}) ⇒ Object
Outputs the Deduce ingest Javascript code.
Instance Method Details
#deduce_event_post(event, email, additional = {}, options = {}) ⇒ Object
Sends an event to Deduce
33 34 35 36 37 38 39 40 41 |
# File 'lib/rack/deduce/ingest/helpers.rb', line 33 def deduce_event_post(event, email, additional = {}, = {}) 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, html = html.html_safe if html.respond_to :html_safe html end |
#deduce_ingest_html(email, options = {}) ⇒ Object
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.
23 24 25 |
# File 'lib/rack/deduce/ingest/helpers.rb', line 23 def deduce_ingest_html(email, = {}) Rack::Deduce::Ingest.html email, end |