Scripting

Define custom analytics with declarative expressions

Objective

Joule core provides the ability to deploy declarative expressions using the custom analytics processor.

This has been reused within the context of feature engineering to enable users to define custom calculations within the DSL.

Example & DSL attributes

The example demonstrates per-event calculation of a spend_ratio using a JavaScript-based expression, where users can define variables, such as avg_spend to customise the calculation.

Example

feature engineering:
  ...
  features:
    compute:
      spend_ratio:
        scripting:
          macro:
            expression: 1 - spend/avg_spend
            variables:
              avg_spend: 133.78

Attributes schema

Attribute
Description
Data Type
Required

expression

A valid mathematical expression

String

language

List of supported feature functions

String

Default: js

variables

Map of variables to be used during the execution of the expression.

Map

Last updated