Example: Complex Metrics - evolv-ai/metrics GitHub Wiki
The following are a set of more complex examples.
Checking for threshold of input value when CTA is clicked:
{
"source": "dom",
"key": "form select.amount",
"type": "number",
"on": "change",
"extract": {
"attribute": "value",
"parse": "[0-9,]+.?$"
},
"apply": [
{"tag": "amount", "action": "bind" },
{"tag": "amount.selected", "action": "event"},
{"tag": "below-ten.selected", "action": "event", "when" : {"operator": "<", "value": 10000}},
{"tag": "above-ten.selected", "action": "event", "when" : {"operator": ">=", "value": 10000}}
]
}
This example waits for the value of the element matching form select.amount
and then extracts the numeric value from that element and then does the following:
- binds the value to audience attribute 'amount'
- creates event
amount.selected
- if then generates event
below-ten.selected
if the value is less than 10000 orabove-ten.selected
if the value is more or equal to 10000
more to come...