Search code examples
asp.net-mvcsitecorepersonalization

Sitecore Personalization on Outcomes


I'm trying to show a component dependent on a Sitecore outcome. I've confirmed that this outcome is being triggered and given to the contact.

Sitecore outcome history

Now I have a rule set up to either show or hide a component dependent on this outcome. Sitecore rule engine

The rule never passes. If I change the rule to something like a specific page being viewed it works fine. Changing it back to the outcome rule causes it to always fail.

Am I doing something wrong? I have the full Experience Platform.

EDIT: I'm using Sitecore 8.0

Code for registration:

if (Tracker.Current == null)
            return false;

        ID group = GroupOutcomes[groupId]; //array of item ids for the outcomes
        if (Tracker.Current.HasOutcome(group))
            return false;

        ID id = ID.NewID;
        ID interactionId = ID.Parse(Tracker.Current.Interaction.InteractionId);
        ID contactId = ID.Parse(Tracker.Current.Contact.ContactId);

        var finalGroup = new ContactOutcome(id, group, contactId)
        {
            DateTime = DateTime.UtcNow.Date,
            MonetaryValue = 0,
            InteractionId = interactionId
        };

        Tracker.Current.RegisterContactOutcome(finalGroup);

I see the outcome being given to the contacts and I actually display a contacts outcomes on the page load to see if the definition Ids match and they do.


Solution

  • Answering this in case someone has a similar problem.

    This was a bug in Sitecore 8.0. Here is what I did with help from Sitecore to fix the problem

    Solution:

    1) Navigate to the "/sitecore/system/Settings/Rules/Definitions/Elements/Outcomes/Contact Has Registered Outcome During Any Interaction" item and change its Text field as follows: where the current contact has registered the [OutcomeDefinition,Tree,root=/sitecore/system/Marketing Control Panel/Outcomes,outcome] during any interaction

    2) Save and publish the item.

    3) Navigate to the "/sitecore/system/Settings/Rules/Definitions/Elements/Outcomes/Contact Has Registered Outcome During Any Interaction with Value" item and change its Text field as follows: where the current contact has registered the [OutcomeDefinition,Tree,root=/sitecore/system/Marketing Control Panel/Outcomes,outcome] during any interaction where monetary value [operatorid,Operator,,compares to] [value,Decimal,,value]

    4) Save and publish the item.