-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Tell me if I understand it right. When the event comes you count some interests and save it in profile:
Then you want it to degrade over time? If this is the case then your approach with cron is not very efficient. Although there is a possibility to schedule tasks in Tracardi is is not available in the community version, and it if not the approach you would like. I will not scale and will make unnecessary calls to tracardi just to decrease the interests. If you have like millions of profiles then it will slow the system. I see several approaches to solve your needs. One is that you save interest as you do it now. And on the client side you calculate the drop in value of the profile interest (the insert time is available in profile so you can calculate the passed time). Pros - it is simple solution, Cons - you will not be able to search the entire index for profiles that has low - degraded interest. Only query single profile will get you a drop in interest metric. Though, you could query profile based on time and calculate the drop in interest metric for every record. Second approach it to use Runtime field in elastic. They are computed at runtime with Painless script. I could event think about implementing it in tracardi REST API. Maybe it is even possible to make it a part of GraphQL - do not know right now. You may need to change the profile mapping to do that. There is a third option, but it is not available right now. I am working on a metric worker that will run inside tracardi and can perform different tasks in background. For that it needs a simplified math script language to perform these task so a work on it will take some time. An last approach is that you connect directly to elastic and run queries on the profile index that will decrease the interests over time. Task for Tracardi community
|
Beta Was this translation helpful? Give feedback.
-
Hi @atompie, we came up with a different solution. It would be the combination of the IF action and a new DIVIDE action. The DIVIDE action would work similar to the KEY COUNTER. It takes a property (int or array of int) and a number to divide the number(s) with. Eg.:
We'll need the IF action to check a custom date field if the previous DIVIDE action has not ran in a week or so. So we still need a few parts of this solution:
IF action example:
COPY TRAIT action example:
|
Beta Was this translation helpful? Give feedback.
-
Solution implemented in 0.6.0CalculatorThis plugin performs simple operations such as add, subtract, divide, and multiply. Arguments of those operations may be Each operation must be in separate row. Operations may share variables. Example 1
This calculation will divide the value from profile that is located in traits.private.interests.sports by the number {
"result": <some-value>,
"variables": {}
} Example 2 - variables
This simple calculation assigns value to variable decay_rate. Then uses this value to compute result.value. This {
"result": <some-value-equal-to-last-operation-result.value>,
"variables": {
"decay_rate": 2,
"result": {
"value": <some-value-equal-to-last-operation-result.value>
}
}
} This way you can construct object that have different values that are calculated and assigned to variables. Of course
Compound calculationsCalculations may have several operations.
The result of this calculation is: {
"result": 2.6666666666666665,
"variables": {
"a": 1.6666666666666665,
"b": 1,
"c": 2.6666666666666665
}
} Each number can be replaced by variable or a field from profile, event, etc. Negative values
The result of this operation is: {
"result": -1,
"variables": {}
} And the event@counter equals 1. |
Beta Was this translation helpful? Give feedback.
Solution implemented in 0.6.0
Calculator
This plugin performs simple operations such as add, subtract, divide, and multiply. Arguments of those operations may be
values from payload, profile, etc. The result is returned as an object of new values.
Each operation must be in separate row. Operations may share variables.
Example 1
This calculation will divide the value from profile that is located in traits.private.interests.sports by the number
provided in payload (time_passed). Value of time_passed can be a time that passed from the last visit. The above
equation will return the follow…