Block events that do not match the specified names or data.
This constraint is created implicitly if you define the .events property on a metric.
{
name: 'Logged in',
constraints: [
TypeConstraint([
'logged-in'
])
]
}
events | Array.<String | TypeConstraint~EventChecker> Passing a string for an event name ignores the event data. If you want to filter by data or context, implement the structure described below. |
A specification for both event name and the data (or context) it is triggered with.
{
name: 'Logged in (mobile)',
constraints: [
TypeConstraint([
{ name: 'logged-in', when: data => data.isUsingMobile }
])
]
}
String
The name of the event.
(Object, Object) -> Boolean
A predicate function to check if the data is OK. Arguments are [data, context].