Applying Scores

When you apply tags to interactions, you're adding text labels as metadata. Alternatively, you can use scoring to add numerical values, again based on one or more conditional tests. For example, here are four tag definitions in the same namespace:

// Strong desire or indicates buying intention
tag.sales.lead_score +20 { interaction.content contains_any "want, considering, buy, need" }

// Likes the product 
tag.sales.lead_score +10 { interaction.content contains_any "love, awesome, brilliant" }

// Has concerns
tag.sales.lead_score -5  { interaction.content contains_any "expensive, cost" }

// Strongly put off purchasing
tag.sales.lead_score -15 { interaction.content contains_any "unreliable, poor review" }

All of these scoring rules affect the final value of tag.sales.lead_score, either adding to it or subtracting from it. For instance, suppose an interaction contains this text:

I might buy one, but they look quite expensive

The first of these scoring rules matches "buy" so we add 20 to the score. The second rule does not match but the third matches "expensive" and so we subtract 5. Since the last rule does not match anything, the overall score is 15.

In this case, all the scores are integer values but they are stored as floating point numbers so you can use decimals in your CSDL. We support accuracy to 13 significant figures, although numbers are held internally to greater accuracy to ensure there are no rounding errors.

Understanding the output

If we apply tags to these two input objects:

{
    "interaction": {
        "content": "I might buy one, but they look quite expensive"
    }
}

{
    "interaction": {
        "content": "It looks brilliant, but I've heard it's unreliable"
    }
}

The output looks like this:

{
    "interaction": {
        "content": "I might buy one, but they look quite expensive"
    },
    "tag_tree": {
        "sales": {
            "lead_score": 15
        }
    }
}

{
    "interaction": {
        "content": "It looks brilliant, but I've heard it's unreliable",
        "tag_tree": {
            "sales": {
                "lead_score": -5
            }
        }
    }

For reasons of brevity, these JSON objects are shown here as fragments with only the relevant elements visible.