Keen Destination
Keen quick info
Keen accepts Track, Page, and Identify calls. If you reference it in the Integrations object, call it “Keen IO", or "Keen”.
Keen accepts data in cloud-mode from all source types, and can accept data in device-mode from Analytics.js sources. You can change the Keen connection mode for Analytics.js sources from the destination settings in the Segment web app.
Getting Started
When you enable Keen in the Segment web app, your changes appear in the Segment CDN in about 45 minutes, and then Analytics.js starts asynchronously loading keen.js
onto your page. This means you should remove Keen’s snippet from your page.
- Since Keen only records custom events and custom user data, no events or users will appear in Keen until you start using the API outlined below.
Keen is supported on the client side and server side.
Identify
Client-Side
When you call identify
on analytics.js
, we call Keen’s setGlobalProperties
and set the user
field with userId
and traits
.
Note: To see this information inside Keen, 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.
Track
Client-Side
When you call track
or one of its helpers functions on analytics.js, we call Keen’s addEvent
with exactly the same parameters.
Server-Side
When you call track
on on the server-side, we route the event to Keen.
If you make the following Segment call using any of the server-side sources,
analytics.track('user@example.com', 'Purchased', {
item: 'T-Shirt',
revenue: 19.99
});
We will forward the following to Keen:
- Event Collection:
Purchased
- Event Properties:
{ userId: 'user@example.com' item: 'T-Shirt', revenue: 19.99 }
Personas
You can send computed traits and audiences generated using Segment Personas to this destination as a user property. To learn more about Personas, contact us for a demo.
For user-property destinations, an identify call is sent to the destination for each user being added and removed. The property name is the snake_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Personas sends an Identify call with the property order_completed_last_30days: true
. When the user no longer satisfies this condition (for example, it’s been more than 30 days since their last order), Personas sets that value to false
.
When you first create an audience, Personas sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.
Supported Sources and Connection Modes
Before you start, make sure Keen supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.
Web | Mobile | Server | |
---|---|---|---|
📱 Device-mode | ✅ | ⬜️ | ⬜️ |
☁️ Cloud-mode | ✅ | ✅ | ✅ |
Segment offers an optional Cloud-based Connection Mode for Web data with Keen. As a reminder, this removes the Keen javascript library from your site, improving performance.
Segment offers an optional Device-based Connection Mode for Mobile data going to Keen, so that you can use Keen features that collect data directly from the mobile device. To do this, you must package the Segment-Keen mobile SDK with the Segment mobile library.
Settings
Segment lets you change these destination settings from the Segment app without having to touch any code.
Geo IP Addon
Enable this to use Keen’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
This will track Loaded a Page events to Keen for all page
method calls.
Track Categorized Pages to Keen
This will track events to Keen for page
method calls that have a category
associated with them. For example page('Docs', 'Index')
would translate to Viewed Docs Page.
Track Named Pages to Keen
This will track events to Keen for page
method calls that have a name
associated with them. For example page('Signup')
would translate to Viewed Signup Page.
Track an Initial Pageview
This will send an intial ‘Loaded a Page’ event to Keen when the page is loaded. We disable this by default since Keen is generally used for custom event tracking, not pageviews. Note: you must also have the Send Pageview Events setting enabled for this to work.
URL Parsing Addon
Enable this to use the Keen’s data enrichment feature for parsing URLs into its components for easier filtering. Note that userAgent
is only collected on Android, not on iOS.
UserAgent Addon
Enable this to use the Keen’s data enrichment to parse UserAgent strings.
Write Key
Your write key should be a minimum of 32 characters long and made up of numbers and letters only.
Adding Keen to the integrations object
To add Keen to the integrations
JSON object (for example, to filter data from a specific source), use one of the following valid names for this integration:
-
Keen IO
-
Keen
This page was last modified: 20 Oct 2020
Need support?
Questions? Problems? Need more info? Contact us, and we can help!