Segmentation JSON

Posted by Christian Joergensen. Last updated: Mon, Nov 18, 2013

A rule consists of a JSON objects with these properties:

  • type - Type of rule
  • data - The data to operate on
  • operator - The operator to use
  • operand - The argument for the operator

This table describes the different rule types, data and operators:

Rule type Rule data Rule operator
data ^\d+$ startswith
data ^\d+$ endswith
data ^\d+$ greaterequals
data ^\d+$ greater
data ^\d+$ less
data ^\d+$ lessequals
data ^\d+$ contains
data ^\d+$ equals
data ^\d+$ notequals
data ^\d+$ notstartswith
data ^\d+$ notendswith
data ^\d+$ notcontains
data ^\d+$ empty
data ^\d+$ notempty
data ^\d+$ intlessequals
data ^\d+$ intgreaterequals
data ^\d+$ intgreater
data ^\d+$ intless
data ^\d+$ intequals
data ^\d+$ intnotequals
subscriber ^email$ startswith
subscriber ^email$ endswith
subscriber ^email$ greaterequals
subscriber ^email$ greater
subscriber ^email$ less
subscriber ^email$ lessequals
subscriber ^email$ contains
subscriber ^email$ equals
subscriber ^email$ notequals
subscriber ^email$ notstartswith
subscriber ^email$ notendswith
subscriber ^email$ notcontains
subscriber ^subscriptions$ has_active_subscription_on
subscriber ^subscriptions$ has_no_active_subscription_on
subscription ^activated$ after
subscription ^activated$ before
subscription ^deliveries$ received
subscription ^deliveries$ not_clicked
subscription ^deliveries$ clicked
subscription ^deliveries$ read_online
subscription ^deliveries$ read
subscription ^deliveries$ not_received
subscription ^deliveries$ not_read
subscription ^deliveries$ not_read_online
subscription ^(views|clicks)$ inactivity_after
subscription ^(views|clicks)$ activity_after
subscription ^(views|clicks)$ activity_before
subscription ^(views|clicks)$ inactivity_before

Putting it together as a ruleset

The ruleset is a list of JSON objects (the rules) and a logical operation and or or:

{"mode": "and", rules:[...]}

And with or:

{"mode": "or", rules:[...]}

A finished ruleset might look like this:

{"mode": "and", rules:[{
  "type": "subscription", 
  "data": "views", 
  "operator": "inactivity_after", 
  "operand": "2013-01-01 00:00:00"
}, {
  "type": "subscriber", 
  "data": "email", 
  "operator": "endswith", 
  "operand": "@hotmail.com"
}]}

What next?

Read more articles on these subjects: Segmentation

Keywords

See other articles with these keywords:


Languages

See this article in:


About the author

Christian Joergensen
Head of Engineering

Christian is in charge of the technical operation and development of Ubivox. His articles are often addressed to a technical audience.


Further questions

Do not hesitate to contact us if you have any questions.

Start livechat
Write e-mail