Macros - evolv-ai/metrics GitHub Wiki
Macros are useful when common attributes need to be used, but cannot be easily shared via inheritance.
Macros allow a set of attributes that needs to be duplicated in different places in the configuration to be specified in a defmacros section. When this is done
"defmacros": {
"click-event": {
"source": "dom",
"on": "click",
"action": "event"
}
},
And then used in a metric as:
{
"macro": "click-event",
"source": "button.cta",
"tag": "clicked.button-cta"
}
This would result in the following evaluation for the metric:
{
"source": "dom",
"on": "click",
"action": "event",
"source": "button.cta",
"tag": "clicked.button-cta"
}