-
Notifications
You must be signed in to change notification settings - Fork 0
Attribute: key
Richard Cowin edited this page Nov 28, 2023
·
4 revisions
The key
attribute specifies where to get the value from the specific source as specified in the source
attribute.
The source
attribute is used with the key
attribute to specify where the data for a metric will come from.
The following table explains the possible values for the source
attribute.
Source | Key (usage) | Wiki Link |
---|---|---|
dom | css selector | Source: dom |
expression | js expression | Source: expression |
query | name of query parameter | Source: query |
cookie | cookie name | Source: cookie |
localStorage | localStorage key | Source: localStorage |
sessionStorage | sessionStorage key | Source: sessionStorage |
extension | name of extension | Source: extention |
on-async | expression to async function | Source: on-async |
promise | coming soon... |
{
"source": "dom",
"key": "button",
"action": "event",
"on": "click",
"tag": "button.clicked"
}
{
"source": "expression",
"key": "window.data.productName",
"action": "bind",
"tag": "product.name"
}
{
"source": "query",
"key": "utm_source",
"action": "bind",
"tag": "campaign.source"
}
{
"source": "localStorage",
"key": "logged-in",
"action": "bind",
"type": "boolean",
"tag": "user.logged-in"
}