Segment

<Segment
name={`Segment ${idx+1}`}
filter={ Utils.createUserFilter(clusters.data.segments[idx]) }>
Create Segment
</Segment>

Use <Segment> to create a link inside of your Insight, which once clicked, opens a segmentation filter modal, with all segment user properties set already. This can be used for example when displaying the results of a clustering analysis, where each cluster becomes a clickable link, allowing end-user of Insight to easily use this segment anywhere in reports, intelligence models, etc.

const intelligenceModel = new Intelligence({
goal: {
event: 'paid',
times: 1
}
});
const clusters = await PluginData.get('clustering', {data: intelligenceModel});
return {
clustersCount: clusters.data.segments.length,
clusters: clusters.data.segments,
origResult: clusters
};
<Insight title='Automatic User Segments'>
<Title>Shows all the user segments found in your data</Title>
<Txt>
Segment 1 looks like a group with high conversion, using from desktop computers.
<Segment name='Segment 1' filter={ Utils.createUserFilter(data.clusters[0], data.origResult) }>Create segment from this.</Segment>
</Txt>
<Txt>
Segment 2 looks like a group with average conversion, using from mobile devices.
<Segment name='Segment 2' filter={ Utils.createUserFilter(data.clusters[1], data.origResult) }>Create segment from this.</Segment>
</Txt>
</Insight>

Parameters

{name: "filter", type: "object", description: An valid filter object. This can be created through a utility function: ${this.code("Utils.createUserFilter(['(', ['feature_abc', '=', 'green'], ')', 'OR', '(', ['feature_def', '>', 30], ')'], data.origResult)")}. The clusters object is the result object of a ${this.code("PluginData.get")} call.}