Segmentation

Administrators can assign segments to each content based on various data available in the customer’s profile. This data includes insurer’s data, enriched data from the Insurance Data Catalog, and calculated data like propensity scores.

  • Insurer’s data: customer’s profile, family, contracts, quotes, claims, etc.

  • Enriched data from the Insurance Data Catalog: weather, points of interest near the customer’s location, customer’s interests, etc.

  • Calculated data: propensity scores, predicted life events, etc.

This documentation provides guidance on how to create segments using JEXL (JavaScript Expression Language) and examples of contextual information with their corresponding JEXL expressions.

Create and Use segmentation

Use the Segmentations tab to create specific targets. These segmentations could be used as triggers for life events or selling points.

Create Segments
Figure 1. Segments managing page

You can use it on Recommendation’s audience by using the $SEGMENT_NAME variable. :

$SEGMENT_NAME
To view the available segmentations, begin by typing "$". A menu will appear with all of the preconfigured segmentations.
Using Segments
Figure 2. Segments managing page

JEXL rules

JEXL (Javascript Expression Language) is used to define the rules and conditions for the segments. It is a powerful context-based expression parser and evaluator. You can find the complete documentation for JEXL here >> https://www.npmjs.com/package/jexl

The main operators

JEXL supports various operators to perform logical, arithmetic, and comparison operations. Some of the main operators include:

Negate

!

Logical AND

&&

Logical OR

||

Equal

==

Not equal

!=

Greater than

>

Greater than or equal

>=

Less than

<

Less than or equal

<=

Match

~

To check if a value is in a list

in

Examples :

The customer’s socio occupational group is in the following list:

file.socio_occupational_group_id in ["33","45","52","34"]

Customers aged over 22:

file.age >=22

Functions

There are two kinds of functions:

  • Transformers, used with the "|" symbol, like this:

    file.contracts | function
  • Functions, used like this:

    hasKeyword(file.claims, "theft")

Here are some available functions:

size

Calculate the size of an array

Transformer

age`

Convert a date to age

Transformer

toDate|ageIn("M")

Convert a date to months

Transformer

toDate|ageIn("Y")

Convert a date to years

Transformer

uniq

Remove duplicates from an array

Transformer

toUpper

Convert a string to uppercase

Transformer

toLower

Convert a string to lowercase

Transformer

toInteger

Convert a string to an integer

Transformer

split("character")

Split a string by a character

function

Examples: Customer aged more than 75:

file.birthDate| age  > 75

Take the first part of the address mail:

fille.email|split("@")[0]

Examples of contextual infos with their Jexl expression

Below are examples of contextual information based on the JSON customer file. These examples demonstrate how to use JEXL expressions to define the conditions for different segments:

  1. The customer doesn’t own a Health contract :

    !file.contracts[.product_id == 'HEALTH'][0]
  2. The customer owns a Car contract : Tip: To test a value from a table, you have to double negate (!!)

    !!file.contracts[.product_id == 'AUTO'][0]
    [source,javascript]
    products[.product_id == "AUTO" ] | size >= 1
  3. The customer has already had a material claim covered on one of his Car contracts:

    !!file.contracts[.product_id == 'AUTO' && .claims[.damage == 'MATERIEL' && .covered == true][0]][0]
  4. The customer has already had an uncovered claim on one of his contracts:

    !!file.contracts[.claims[.covered == false][0]][0]
  5. The customer’s principal home is in the department 75:

    file.homes[.quality == 'PRINCIPALE'][0].department == 75

By leveraging JEXL expressions, you can create complex and dynamic segments based on various criteria, leading to more personalized and targeted content recommendations for customers in the Zelros platform.