Skip to main content
Setting up Segmentation

By sending Candu data attributes about your users you can personalize their experience within your application.

Lauren Cumming avatar
Written by Lauren Cumming
Updated this week

With Candu, you can create and publish unique content to different user segments. To create user segments, you must send the necessary data attributes to Candu, either directly or via a third-party provider.

Required: Please note that you will need to be able to identify users with a unique ID, such as an ID you have assigned them or their email address; otherwise, they will be tracked anonymously.

Sending User Data Directly

A common option to get your user data into Candu is sending it directly via the installation script.

You must send Candu your UserId (unique ID or email address) so we can identify your users.

To do that, you must specify a UserId parameter in Candu's installation script.

An example init Script

<script>
(function(d, params){
var script = d.createElement('script');
script.setAttribute('src', 'https://cdn.candu.ai/sdk/latest/candu.umd.js?token=' + params.clientToken);
script.onload = function () { Candu.init(params); }
d.head.appendChild(script);
})(document, {
clientToken: 'YOUR_CLIENT_TOKEN',
userId: 'YOUR_USER_ID',
});

You can then pass through the data:

  • Any user traits about your users such as email, role type, plan type, and company name

  • Any user events such as completion of key product actions like 'Invited team member'

You will be able to use this data for segmentation and personalization purposes.

User Traits Example

<script>
(function(d, params){
var script = d.createElement('script');
script.setAttribute('src', 'https://cdn.candu.ai/sdk/latest/candu.umd.js?token=' + params.clientToken);
script.onload = function () { Candu.init(params); }
d.head.appendChild(script);
})(document, {
clientToken: 'YOUR_CLIENT_TOKEN',
userId: 'YOUR_USER_ID',

// ADD ANY TRAITS IN THE OBJECT BELOW
traits: { email: '[email protected]' },
});
</script>

To see all the options available when initializing Candu, please take a look at the Javascript API.

Reserved traits Candu has standardized

Trait

Type

Description

email

String

Email address of a user

Please make sure to send the email through with a lowercase 'e'.

User Events Example

You can pass user events by calling the window.Candu.getEventing() method in the Candu singleton. For full details, please take a look at the API page.

Third-party Integrations

Segment.io Integration

This integration sends user event data via the Segment.io function to Candu, where it can be used to personalize content.

If you use Segment.com to send Candu user event data, you must send it as identify calls with user traits.

If you are using Segment.io to send Candu user event data, you will need to send it as identify calls with user traits.
analytics.identify("some_user_id", { name: "Some Person", email: "[email protected]", logins: 5});

For more information on installing Segment integration, please refer to the Segment section in the Candu Destination documentation.

To create user segments, an identify event with traits is required. Tracking events with properties will not be sufficient.

Did this answer your question?