See the Overview for details about setting up the Datacoral Collect Events Slice and setting up keys.
Step 1: Install the ruby instrumentation module
In your Gemfile, add the source for snowplow-tracker gem
gem "snowplow-tracker", :git => "git+ssh://firstname.lastname@example.org/diffusion/RUBYEVT/Ruby-Events.git"
In your .gemspec file, add 'snowplow-tracker' to your dependencies by adding:
spec.add_runtime_dependency "snowplow-tracker", ">= 0.7.0"
Step 2: Sample Ruby Tracking
Substitute the appropriate environment parameters based on the following definitions.
URL_ENDPOINT : The URL of your Datacoral Events API gateway. Ex. events.dccustomer.datacoral.io
API_KEY : The Datacoral API key to authorize the events invocations. Ex. 1js9q5Gqmk2VDv2omx2WI3yUGV0K7b464fWUJXDX
ENVIRONMENT : Set the environment as
prod, based on the emitter of the events
NAMESPACE : The name of this Tracker instance to include with events sent to the collector. The namespace argument attached to every event fired by the new tracker. This allows you to later identify which tracker fired which event if you have multiple trackers running. Ex. landing_pages
APP_ID : Name of application to include with events sent to the collector. The application ID is used to distinguish different applications that are being tracked by the same Snowplow stack. Ex. "finance" or "hr"
# Initialize the tracker # Require the snowplow-tracker gem: require 'snowplow-tracker' # Initialize an emitter instance. This object will be responsible # for how and when events are sent to datacoral. # Substitute appropriate values for Collector endpoint, api key and datacoral environment. e = DatacoralEmitter.new('URL_ENDPOINT', # Collector endpoint 'API_KEY', # api key 'ENVIRONMENT' # datacoral environment ) # Initialize a tracker instance like this: s = SnowplowTracker::Subject.new s.set_platform('mob') # Substitute appropriate value for app_id. t = SnowplowTracker::Tracker.new(e, s, 'NAMESPACE', 'APP_ID', true) # You can set the user id to any string: t.set_user_id('my_user_id');