首页 > 解决方案 > Apache UNOMI 中的段创建问题

问题描述

过去两周我一直在探索 Unomi,在此过程中,我创建了用户会话和事件,并在用户属性和事件类型上创建了一些片段,但是当我想在事件属性上创建片段时我卡住了。

首先是我们发送给 unomi 的事件——

{
   "source":{
       "itemType":"pageView",
       "scope":"the-coolest-website",
       "itemId":"pageView"
   },
   "events":[
      {
         "eventType":"view",
         "scope":"the-coolest-website",
         "source":{
            "itemType":"pageView",
            "scope":"the-coolest-website",
            "itemId":"pageView"
         },
          "properties":{
               "myProperty":"myValue"
          }
      }
   ]
}

我们正在尝试做的是创建一个针对具有此 myProperty:myValue 键值对的事件的细分。

我创建的段如下:

{
    "metadata": {
        "id": "myPropertySegment",
        "name": "myPropertySegment",
        "scope":"the-coolest-website",
        "description": "The user has this segment if it has acessed our products Website.",
        "readOnly": true
    },
    "condition": {
        "parameterValues": {
            "subConditions": [
                {
                    "parameterValues": {
                        "propertyName": "myProperty",
                        "comparisonOperator": "equals",
                        "propertyValue": "myValue"
                    },
                    "type": "eventPropertyCondition"
                }
            ],
            "operator": "and"
        },
        "type": "booleanCondition"
    }
}

在上述事件属性段中,用户没有资格将事件属性设置为“myProperty”:“myValue”。

在事件类型上创建了另一个细分:

{
    "metadata": {
        "id": "eventCondition",
        "name": "eventCondition",
        "scope": "the-coolest-website",
        "description": "The user has this segment if it has acessed our products Website.",
        "readOnly": true
    },
    "condition": {
        "parameterValues": {
            "subConditions": [
                {
                    "parameterValues": {
                        "propertyName": "eventType",
                        "comparisonOperator": "equals",
                        "propertyValue": "myAwesomeUserEvent"
                    },
                    "type": "eventTypeCondition"
                }
            ],
            "operator": "and"
        },
        "type": "booleanCondition"
    }
}

在上面的事件类型段中,用户有资格将 eventType 设置为 myAwesomeUserEvent。

请在创建事件属性段时帮助我,如果我在创建段时出错,请告诉我。

标签: apache-karaf

解决方案


推荐阅读