0

I have created 2 goals and assigned 5 points to each goals. Now in Component level personalization, I want to compare engagement points of each goal and display the content based on the comparison, if goal1 has more points compare to goal2 then display the content accordingly.

Do we need custom personalization to implement such type of scenario?

  • What version of Sitecore are you using? – Hishaam Namooya Sep 4 at 9:23
  • Sitecore Version 9.2 – Shailesh Sep 4 at 9:24
3

You will require to implement a custom rule as there are no rules OOTB Sitecore that allows the comparison of total engagement value of goals. The current rules about the Sitecore goals are mainly attached to the contact.

To retrieve the goals total engagement value, you can do the following:

var goalDefinitionManager = ServiceLocator.ServiceProvider.GetDefinitionManagerFactory().GetDefinitionManager<Sitecore.Marketing.Definitions.Goals.IGoalDefinition>();

// Get by ID and culture. Will get the latest active version.
// Pass in boolean true or false as 3rd parameter to return the inactive goal or not
Sitecore.Marketing.Definitions.Goals.IGoalDefinition goalOne = goalDefinitionManager.Get(goalId, CultureInfo.InvariantCulture);

var totalEngagementValue = goalOne.EngagementValuePoints;

The above code will be used in your custom personalization rule. You may have a rule where you can configure the 2 goals then perform the comparison

So the rule will look like

Is Goal specific greater than Goal specific

The specific is a selection that allows you to select the Goal Id.

Usage

You'll need to configure the rule twice where you will alter the goal position in the rule.

More information about Goals can be found here.

  • Thanks for Code and giving the Idea .. let me try – Shailesh Sep 4 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.