Rack::Deduce::Ingest
Rack middleware for Deduce's data ingestion API.
Installation
Add this line to your application's Gemfile:
gem 'rack-deduce-ingest'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-deduce-ingest
Usage
Configuration
Rack::Deduce::Ingest
requires a Site ID and apikey, provided by Deduce. If you
have not been given one, please contact Deduce for more information.
Rails
A Railtie is included in this gem which will load the middleware automatically. You will need to set the middleware parameters in your app configuration:
config.deduce_ingest.site_id = "your site id here"
config.deduce_ingest.apikey = "your apikey here"
Sinatra, etc.
use Rack::Deduce::Ingest, "your site id here", { :ssl => false }
helpers Rack::Deduce::Ingest::Helpers
Sending Data to Deduce
Within your view, use the helper +deduce_ingest_html+ to include the Javascript collection code.
deduce_ingest_html("[email protected]")
You may send an options hash if you need to override any of the configuration options.
deduce_ingest_html("[email protected]", ssl: false)
For a Rails site, be sure to mark the output as html safe.
Sending Events to Deduce
Within your controller, use the helper +deduce_event_post+ to notify Deduce of events.
deduce_event_post('marzelize', "[email protected]")
Depending on the event type, additional data be send by passing an additional hash. You should consult with Deduce support for specific parameters and event types.
deduce_event_post('marzelize', "[email protected]", {weather: 'cloudy'})
Best Practices
Only pass information that you have already verified to be valid.
Work closely with your Deduce support representative.