Event Slice Overview

This section of the documentation is useful if you have the Datacoral Collect Events Slice already added to your Datacoral Installation. If you want one please contact support@datacoral.co for now. We are working on allowing you to add your own Collect Events Slice using the CLI.

Our default Collect Events Slice is compatible with the Snowplow Tracker Protocol.

We also have a few other events slices. Please contact us if you want to learn more.

Snowplow provides tracker or instrumentation libraries in several languages. We have incorporated those libraries and enhanced them to support

  1. pointing to your own Events HTTP Endpoint,
  2. generating API Keys,
  3. multiple environments like dev/stage/prod so that events can be segregated based on the environments, and
  4. for browser js instrumentation, specifying CORS Origins

Below are the steps to go through to setup instrumentation using Datacoral Collect Events Slice.

Step 1: Specify the Environments

Before Datacoral can install the Collect Events Slice for you, you will have to specify the following:

  1. Environments: Typically, you want to have dev, stage, and prod environments. Some companies also have a uat environment.
  2. If you plan to use Browser JS Instrumentation, specify the CORS Origins corresponding to each environment. So, you would need to provide a mapping table that looks like this:
{
"dev": ["*://127.0.0.1:*"],
"stage": ["*://stageenv.company.co, *://internal.company.com"],
"prod": ["https://company.com", "https://www.company.com"]
}

Step 2: Add the Collect Events Slice

Once you provide the above configuration, Datacoral will deploy the Collect Events Slice for you and give you the following:

  1. Events endpoint: Typically this looks like events.company.datacoral.io

  2. Table of API Keys for different environments:

EnvironmentAPI Key
devjkBq6yLbwR5apjeYLo8tP9slV4OJNxeX7FId5grM
stageasdaf6yLbwR5apjeYLo8tP9slV4OJNxeX7FId5grM
prodiuuasdoaaskio87ho1hu18hli13498h8y1h4o8hoy

Step 3: Access git repositories

Other than for Browser Instrumentation and Pixel Tracking where you can directly point to the libraries that are served directly from datacoral, you would have to depend on the Datacoral Instrumentation Libraries in different languages from our git repositories. When you install Datacoral, your AWS account will have access to the S3 bucket with the pem file.

A: Download the SSH key for the tracker library repo from S3

aws s3 cp s3://datacoral-install-eu-west-1/tracker/datacoral_git.pem ~/.ssh/
chmod 0400 ~/.ssh/datacoral_git.pem

Your AWS account should already have access to the S3 bucket that has the SSH Key needed. Please contact support@datacoral.co if you don't have permissions.

B: Add the ssh-key to your agent

ssh-add ~/.ssh/datacoral_git.pem

Step 4: Add instrumentation to your app

See the rest of the documentation section for examples of adding instrumentation calls to your application in different languages.

Step 5: Query event data in Redshift

In redshift, the events land into time series tables. Depending on the env chosen in the code, the data ends up in a different schema events_<env> where env is one of the environments specified while configuring the Collect Events Slice. For custom events, you should be able to fetch the specific columns by running the following query:

SELECT
(TIMESTAMP 'epoch' + collector_tstamp/1000 * INTERVAL '1 second') AS "Time",
app_id,
name_tracker,
ue_data,
ctx_experiment,
ctx_custom
FROM
events_dev.events_view