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

Required: the ability to identify users with a unique ID, otherwise they will be tracked anonymously.

Sending User Data Directly

To send us through data directly, you need to pass your UserId through to Candu via the installation script.

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

For 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',
});

You can then pass through any user traits such as email, phone and company or user events such as completion of key product actions that you want to use for Segmentation purposes.

To see all the options available when initialising Candu, please refer to the Javascript API.

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>

User Events Example

You can pass user events by calling the window.Candu.getEventing() method in the Candu singleton. For full details, please refer to 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 are using Segment.io to send Candu user event data, you will need to send it as identify calls with user traits. For example:

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.

ℹ️ In order to create user segments, an identify event with traits is required. Tracking events with properties will not be sufficient.

Did this answer your question?