Tag Expressions

Tag Expressions are used to define the audience for a campaign. They are simple trees, described using JSON. Each node is structured as follows:

{
  "tag_sids": []        // Array of tag_sids or null for non-leaf nodes.
  "left": null,         // Left-hand child node
  "right": null,        // Right-hand child node
  "operator" : "UNION"  // Operator to apply to the node
}

tag_sids

The tag_sids member is a list of the sids for the tags (groups in the user interface) relevant to the node. It should be null if the node has children, or if the node if being used to refer to all subscribers ("Everyone" in the user interface).

left & right

The left and right members refer to the left and right child nodes of the expression. If unused, they should be null.

operator

The operator member describes the operation to be performed on the node. The operators are UNION, DIFFERENCE, and INTERSECTION. These operators correspond to the set operations with the same names.

For leaf expressions, the UNION and INTERSECTION operators are supported. This makes it possible to express "Subscribers in Seattle who are Pop Music fans" as the INTERSECTION of Seattle, Pop, and Music. "Subscribers in Minnesota or NFL fans or anyone interested in the Super Bowl" is expressed as the UNION of Minnesota, NFL, and Super Bowl.

For inner expressions (non-leaf expressions), only the DIFFERENCE operator is supported.

Examples

// The union of subscribers in the two groups
{
  "tag_sids": ["XsbrYCSo2m0sShMLOlZqtw", "sRhvpNDGZwyDeH-YRZIr9A"],
  "left": null,
  "right": null,
  "operator" : "UNION"
}

// The union of the subscribers in the two groups in the left node, except for the subscribers
// in the group in the right node
{
  "tag_sids": null,
  "left": {
    "tag_sids": ["XsbrYCSo2m0sShMLOlZqtw", "sRhvpNDGZwyDeH-YRZIr9A"],
    "left": null,
    "right": null,
    "operator" : "UNION"
  },
  "right": {
    "tag_sids": ["3mesNha3El_vwtUUC-iW8R"]
    "left": null,
    "right": null,
    "operator" : "UNION"
  },
  "operator" : "DIFFERENCE"
}

// All subscribers except for the subscribers in the group in the right node
{
  "tag_sids": null,
  "left": {
    "tag_sids": null,
    "left": null,
    "right": null,
    "operator" : "UNION"
  },
  "right": {
    "tag_sids": ["3mesNha3El_vwtUUC-iW8R"]
    "left": null,
    "right": null,
    "operator" : "UNION"
  },
  "operator" : "DIFFERENCE"
}

If you have questions, please contact Chatitive Support.