-
Notifications
You must be signed in to change notification settings - Fork 0
Inheritance
Richard Cowin edited this page Nov 28, 2023
·
5 revisions
Inheritance is the idea of passing down common information (within Attributes) to descendants of the current metric. The descendants can override the inherited attributes (and this is needed if you want to use Conditions). The mechanism of a metric passing inherited values is through the use of the apply attribute. When apply is present, the current metric is classified as an Abstract Metric.
In the following example, we have several metrics activating on click events within a page:
{
"source": "dom",
"on": "click",
"action": "event",
"apply": [
{
"key": "a[href*=\"account/register\"]",
"tag": "sign-up-flow.cta.click"
},
{
"key": "form a[href*=\"cart\"], button.addToCart",
"tag": "add-to-cart.cta.click"
}
]
}