Keen IO Destination

Segment makes it easy to send your data to Keen IO (and lots of other destinations). Once you've tracked your data through our open source libraries we'll translate and route your data to Keen IO in the format they understand. Learn more about how to use Keen IO with Segment.

Getting Started

When you toggle on Keen IO in Segment, this is what happens:

  • Our CDN is updated within 5-10 minutes. Then our snippet will start asynchronously loading keen.js onto your page. This means you should remove Keen IO’s snippet from your page.
  • Since Keen IO only records custom events and custom user data, no events or users will appear in Keen IO until you start using the API outlined below.

Keen IO is supported on the client side and server side.


Identify

Client-Side

When you call identify on analytics.js, we call Keen IO’s setGlobalProperties and set the user field with userId and traits.

Note: To see this information inside Keen IO, you must make track call as the userId and traits are simply cached on the client. Your subsequent track calls will be appended with the userId and traits.

Server-Side

On the server-side, calling identify has no effect on Keen IO.

Track

Client-Side

When you call track or one of its helpers functions on analytics.js, we call Keen IO’s addEvent with exactly the same parameters.

Server-Side

When you call track on on the server-side, we route the event to Keen IO.

If you make the following Segment call using any of the server-side sources,

analytics.track('user@gmail.com', 'Purchased', {
    item: 'T-Shirt',
    revenue: 19.99
});

We will forward the following to Keen IO:

  • Event Collection: Purchased
  • Event Properties:
    {
      userId: 'user@gmail.com'
      item: 'T-Shirt',
      revenue: 19.99
    }
    

Supported Sources and Connection Modes

WebMobileServer
📱 Device-based
☁️ Cloud-based

To learn more about about Connection Modes and what dictates which we support, see here.

We offer an optional Cloud-based Connection Mode for Web data with Keen IO. As a reminder, this removes the Keen IO javascript library from your site, improving performance. However, there are a few disparities between the Cloud-based and Device-based connection modes to keep in mind brefore enabling it in the Segment app. When you enable the Cloud-based destination mode, here’s what happens:

The latest version is compatible with the prior, but is required for Cloud-based Connection Mode Support. For data recording use cases, we recommend using the cloud-based connection mode with Keen, as our server-side integration offers robust mapping and parity with all of their data enrichment add ons. Note that if you opt out of a device-based connection with Keen, you cannot use their client side library for charting or querying. User data is augmented to the payload in a different manner via our cloud-based integration versus our device-based one, so we recommend writing to a new, dedicated stream if you elect to use the cloud-based connection mode.

Settings

Segment lets you change these destination settings via your Segment dashboard without having to touch any code.

Track Named Pages to Keen IO

This will track events to Keen IO for page method calls that have a name associated with them. For example page('Signup') would translate to Viewed Signup Page.

UserAgent Addon

Enable this to use the Keen IO’s data enrichment to parse UserAgent strings.

Track an Initial Pageview

This will send an intial ‘Loaded a Page’ event to Keen IO when the page is loaded. We disable this by default since Keen IO is generally used for custom event tracking, not pageviews. Note: you must also have the Send Pageview Events setting enabled for this to work.

Geo IP Addon

Enable this to use Keen IO’s data enrichment feature to add geographic information based on IP.

Project ID

Your project ID. It should be 24 characters long, and look something like this: 9181bcd23843312d87000000.

Read Key

If you are a Keen Pro user, enter your read key in the advanced settings tab of your dashboard. It should be a minimum of 32 characters long and made up of numbers and letters only.

Referrer Parsing Addon

Enable this to use the Keen IO’s data enrichment feature for parsing referrer URLs into their source.

Track All Pages to Keen IO

This will track Loaded a Page events to Keen IO for all page method calls.

URL Parsing Addon

Enable this to use the Keen IO’s data enrichment feature for parsing URLs into its components for easier filtering. Note that userAgent is only collected on Android, not on iOS.

Track Categorized Pages to Keen IO

This will track events to Keen IO for page method calls that have a category associated with them. For example page('Docs', 'Index') would translate to Viewed Docs Page.

Write Key

Your write key should be a minimum of 32 characters long and made up of numbers and letters only.


If you have any questions or see anywhere we can improve our documentation, please let us know or kick off a conversation in the Segment Community!