jkevan edited a comment on pull request #265:
URL: https://github.com/apache/unomi/pull/265#issuecomment-804209534


   ### Small update on what we discussed about in the call:
   
   - Do not touch the unomi IncrementInterestAction. This action have his own 
logic and cannot be generify with property incrementation, also the interest 
incrementation from JExperience is not using this action, it's actually using a 
script and the setPropertyAction.
   - Create a new Action: IncrementPropertyAction: 
     - propertyName: to be able to increment or create a single prop 
(properties.pageViewCount)
     - rootPropertyName: to be able to increment all props under this one: (ex: 
profile.properties.interest)
     - incrementWithValues: to be able to increment properties with the values 
coming from the event. (ex: event.properties.interest)
     - storeInSession: to be able to target the profile or the session.
   
   ### Real exemple coming from JEXperience:
   **the increment page count:** 
   ```
   "actions": [
       {
         "parameterValues": {
           "setPropertyName": "properties.pageViewCount",
           "setPropertyValue": "script::r = 
profile.properties['pageViewCount']; if (r == null) { 
profile.properties['pageViewCount'] = []; profile.properties.pageViewCount = 
[event.scope : 1] } else { if (r[event.scope] != null) { r[event.scope] = 
r[event.scope] + 1 } else { r[event.scope] = 1 }} r",
           "storeInSession": false
         },
         "type": "setPropertyAction"
       }
     ]
   ```
   
   We should be able to do it with this kind of conf:
   **type: incrementPropertyAction**
   **paramerterValues:**
   - **propertyName: properties.pageViewCount**
   - **storeInSession: false**
   
   **The increment interest from jexperience:**
   ```
   "actions": [
       {
         "parameterValues": {
           "setPropertyName": "properties.interests",
           "setPropertyValue": "script::r = profile.properties['interests']; 
foreach(interest : event.target.properties['interests'].entrySet()) { if (r == 
null) { r = [interest.key: interest.value] } else if (r[interest.key] != null) 
{ r[interest.key] = r[interest.key] + interest.value } else { r[interest.key] = 
interest.value } } r",
           "storeInSession": false
         },
         "type": "setPropertyAction"
       }
     ]
   ```
   
   We should be able to replace it, with:
   **type:incrementPropertyAction**
   **paramerterValues:**
   - **rootPropertyName: properties.interest**
   - **incrementWithEventValues: target.properties.interest**
   - **storeInSession: false**
   
   This way we will be able to replace the script usage we have in the rules in 
JExperience to use a generic increment action.
   The Existing IncrementInterestAction is missleading, and confusing because 
there is also interest incrementation in jexperience. But the both are 
completely differents.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to