使用 JEXL 进行目标定位指南¶
有关 JEXL 语法的更深入解释,您可以阅读 Normady 项目文档。
如何编写 JEXL 目标定位表达式¶
消息需要包含 targeting
属性(JEXL 字符串),该属性将针对提供的属性进行评估。示例
{
"id": "7864",
"content": {...},
// simple equality check
"targeting": "usesFirefoxSync == true"
}
{
"id": "7865",
"content": {...},
// using JEXL transforms and combining two attributes
"targeting": "usesFirefoxSync == true && profileAgeCreated > '2018-01-07'|date"
}
{
"id": "7866",
"content": {...},
// targeting addon information
"targeting": "addonsInfo.addons['[email protected]'].name == 'Activity Stream'"
}
{
"id": "7866",
"content": {...},
// targeting based on time
"targeting": "currentDate > '2018-08-08'|date"
}