Hello,
I have my Unomi environment collecting event view data from the user
navigation and adding their values correctly into the profile.
The code I'm using is
"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"
}
]
That works just fine :-)
I also have a login event through a form (thanks Serge for the hint
avoiding the CORS issue) where I basically copy the email and merge it all
if necessary.
"actions": [
{
"type": "setPropertyAction",
"parameterValues": {
"setPropertyName": "properties(EMAIL)",
"setPropertyValue": "eventProperty::properties(EMAIL)",
"setPropertyStrategy": "alwaysSet"
}
},
{
"parameterValues": {
"mergeProfilePropertyValue": "eventProperty::properties(EMAIL)",
"mergeProfilePropertyName": "mergeIdentifier"
},
"type": "mergeProfilesOnPropertyAction"
}
]
The problem happens when the user starts a navigation on a new
browser/app/session and starts its navigation anonymously and, after a few
clicks here and there, performs a login.
At this point, when the profiles got merged, all the previous profile
Interests values are overwritten with the current Session Interests values.
So I lost everything that was collected previously.
1 - User starts navigation *for the first time* anonymously (or not)
2 - *Interests are being saved / summed up successfully*
3 - *User performs login* (if haven't performed previously)
4 - *all Interests are saved into the merged profile *
5 - User starts a *new navigation anonymously*
6 - *Interests are being saved / summed up on the current session only* (no
historical)
7 - *User performs login*
8 - *Historical interests values are lost and overwritten with current
session values*
If in the new session the login is performed *before the second anonymous
navigation*, everything works as expected.
What should I do to avoid it?
Thanks!
--
----------------------------------------
Oliver Cabral Jorge
email: [email protected]
cel: (41) 9548 1000
----------------------------------------