Driftrock processes events from multiple sources and glues them together using unique fields on a person e.g an ID or email address. This joined up data is what helps you run marketing people will love, track all your campaigns end-to-end, and help protect privacy. 

There are several ways to send data to the Driftrock platform:

  • Using Driftrock's pre-built integrations. 
  • Via Zapier
  • Via the Driftrock Events API  
  • Connecting Google Analytics to add tracking to your leads. 

Using our pre-built integrations

Currently from the dashboard you can link accounts through the integrations console. You'll find a number of pre-built integrations for data sources and marketing platforms like Facebook, Google, LinkedIn Ads, CRM systems, Google Analytics and many more. 

Sending data via Zapier

Driftrock has a handy Zapier integration to send lead and other event data to Driftrock. Just ask your account manager for more info.

The Driftrock Events API

The Driftrock Events API enables you to flexibly send any events you need.
For example:

  • You may wish to send leads that you captured through forms on your website.
  • Another service you use may be capable of submitting data through a webhook. (e.g. HubSpot, Instapage, JotForm, ChatFuel etc)

Generating an API Key

To generate an API key for your requests, head to the Driftrock dashboard.

  1. Click on your name in the top right hand corner, and choose API Keys from the dropdown that appears.
  2. Click to create a new Webhook Key.
  3. Click generate to build an encrypted webhook URL.

Making requests

You can make a POST request to:

https://external-apis.driftrock.com/webhooks/events

Headers: 

Content-Type: application/json
Authorization: Basic [ base64(KEY:SECRET) ]
Accept: application/json

Body:
The body must be JSON formatted and containing the required or recommended fields:

  • event_type [string]  (required) : this should be set to 'lead' or 'action'. Tell us if you consider this event to be a lead or just an action your users do.
  • event_name [string]  (required) : tell us what label you would like to assign to this event (eg: User signed up, Page view, Purchase )
  • fields [json]  (required) : this is a nested json field, where you send us the attributes of this event (eg: "fields": {"email": "test@driftrock.com", "question_1": "test answer"} ) Note: if this is provided as an array, only the first item in the array will be processed, and it will be treated as a map.
  • event_id [string] (optional) : this can be any ID that is used in your system to uniquely identify this event. If not provided it will be randomly generated.
  • customer_id [string]  (optional) : this can be any ID that is used in your system to uniquely identify a user
  • ga_client_id [string] (optional) : this is the Google Analytics ID that you can provide to allow us to extract marketing info.
  • form_id [string] (optional) : if you sent the webhook based on a particular form then you can specify that here to help with segmentation and routing. 
  • form_name [string] (optional): if you sent the webhook based on a particular form then you can specify the name here to help with segmentation and routing. 
  • created_at [string] (optional) : if you would like to provide a more precise timestamp for when the event occurred.  If not provided it will be set to the moment Driftrock receives the event, this is a subtle distinction but may be important to your business case.  This should be passed in ISO8601 format, (eg: 2019-12-02T10:00:00.000Z) 

Advanced Website Lead Tracking with Google Analytics 

You can connect your Google Analytics account to Driftrock to add UTM source, medium, campaign, content and keyword to all the events that we process from your website forms. To do this, it's enough to send us the user's Google Analytics Client ID in the ga_client_id attribute with each lead as a hidden field from your forms.
You can use this Driftrock script that makes it easier to fetch the GA Client ID and add it into a form.

Driftrock Customer Fields for deterministic matching

You can include any of the following keys in the fields attribute:

  • email 
  • phone_number 

These fields (or the customer_id ) can be used to match on any user you previously sent us.

Example scenario:

You send us an event when a user signs up, only including an email 

{ 
  "event_id": "EE-001",
  "event_type": "lead",
  "event_name": "User signed up",
  "fields": {
    "email": "test@driftrock.com"
  }
}

You send us an event related a form submission, indicating a customer_id and an email 

{ 
  "event_id": "EE-250",
  "event_type": "action",
  "event_name": "User submitted form",
  "customer_id": "UU-001",
  "fields": {
    "email": "test@driftrock.com",
    "question_1": "Test answer",
    "question_2": "Another test answer"
  }
}

You send us an event related to an arbitrary user action which, this time, doesn't include an email address, but only a customer_id 

{ 
  "event_id": "EE-250",
  "event_type": "action",
  "event_name": "User did something",
  "customer_id": "UU-001",
  "fields": {
    "test_field": "something interesting"
  }
}

We now have a sequence of events that allows us to link any future event to the same customer, if at least one of [customer_id , email]  is provided.

Usage

An example with cURL using basic authentication:

curl --user [key]:[secret] https://external-apis.driftrock.com/webhooks/events \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -X POST \
  -d '{"event_type": "lead", "event_name": "User signed up", "event_id": "event1", "fields": {"first_name": "Rick", "last_name": "Sanchez", "email": "rick.sanchez@driftrock.com"}}'

Although it is against best practice, some services won't allow you to send headers, which makes it impossible to authenticate in the way described in the previous section.  For situations such as this, there are also routes that allow you to specify an encrypted API key in the path.

We strongly discourage this approach if it can be avoided.

curl https://external-apis.driftrock.com/encrypted/[ENCRYPTED_API_KEY]/webhooks/events \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -X POST \
  -d '{"event_type": "lead", "event_name": "User signed up", "event_id": "event1", "fields": {"first_name": "Rick", "last_name": "Sanchez", "email": "rick.sanchez@driftrock.com"}}'
Did this answer your question?