Add a custom goal to an experiment in Sitecore Personalize
You can add a custom goal to an experiment to compare performance across different variants by tracking a numerical custom value from a custom event. A custom value like an order item price or number of clicks, is derived from custom event attributes and considered in goal calculations only when the event triggers and after the session closes.
For example, you can create an experiment in Sitecore Personalize and set up a custom goal to monitor the bag item value derived from a custom ADD_BAG
event.
For Sitecore Personalize to select the winning variant based on the custom value, add the custom goal as the experiment's first goal, setting it as the primary goal. If the custom value isn't the main metric but still of interest, add it as a secondary goal. All goals that follow a primary goal are automatically set as secondary goals.
We recommend that you do not add more than one goal with the same event to an experiment. For example, if you create two goals that both use the same custom event, Sitecore Personalize only counts the first goal and ignores the second goal.
The Personalize API is what developers use to run interactive experiments. If you add a custom goal to an interactive experiment, ensure that your organization uses the browserId
attribute when calling the Personalize API. This ensures that the goal is attributed to the correct browser session and the attribution rate is accurate when viewing performance analytics.
To add a custom goal:
-
In the experiment builder, click the Goals tile and click Add Goals.
-
In the Goals pane, click Custom goal.
-
In the Custom goal pane, in the Goal name field, enter a descriptive name for the goal. This name will display on the Performance screen.
-
In the Goal definition section, do the following:
-
In the first drop-down list, select Increase or Decrease to set whether a higher or lower custom value is considered a successful outcome.
-
In the second drop-down list, select Custom value to choose custom value measurements.
-
In the third drop-down list, select one of the following options to measure the custom value:
-
Per session – calculates the average custom value per session of each variant in the experiment. This is done by dividing the total custom value in the variant by the number of sessions in the variant.
-
Per conversion (AOV) – calculates the average custom value of converted sessions of each variant in the experiment. This is done by dividing the total custom value in the variant by the number of converted sessions in the variant.
-
Per guest – calculates the average custom value of each variant in the experiment for each unique guest. This is done by dividing the total custom value in the variant by the number of unique guests in the variant.
-
Total revenue - calculates the total custom value of each variant in the experiment.
-
-
-
In the Custom value to measure field, enter the name of the attribute that contains the numerical value you want to track, for example,
bagValue
. This attribute must be included in theext
object of the custom event sent to Sitecore Personalize. -
In the Track event section, select one of the following operators to track the custom event:
-
Equals - matches the event name you enter in the text field exactly with the
type
parameter from the custom event.Example: If you entered ADD_BAG in the adjacent text field, this option will only track the event with a parameter that exactly matches this string.
-
Regex - matches the
type
parameter from the custom event using a Regular Expression (RegEx) pattern. The RegEx should result in a full match of the event name, not a partial match.Example: If your
type
parameter is ADD_BAG, using the RegEx pattern [a-zA-Z] will not match the full string but only one of its letters, like A. However, if you used the pattern [a-zA-Z]+, it will match the entire string and be able to track that event. -
Starts with - matches the beginning of the
type
parameter from the custom event with a specific string.Example: If you entered ADD_BAG in the adjacent text field, this option will track any event with a parameter that begins with ADD_BAG such as ADD_BAG or ADD_BAG_DISCOUNTED.
-
-
In the adjacent text field, enter the full or partial name, or RegEx pattern of the custom event you want to track. This corresponds to the
type
parameter from the custom event.WarningYou must enter the exact event name, attribute name, and attribute value that your organization passes to the Sitecore Personalize platform, for accurate tracking and goal calculation.
-
Optionally, to refine event tracking, you can use additional custom attributes included in the
ext
object of the custom event.To do this, click Add Attribute and specify the following:
-
Attribute Name - enter the name of the custom attribute. For example,
bagConverted
. -
Operator - select either String Equals or String Not Equals to choose how the attribute value should be matched.
-
Attribute value - enter the required string value of the custom attribute to consider the event successful. For example, when the string equals true.
To add more attributes, click Add attributes and enter the necessary details. Multiple attributes are evaluated using the AND logic.
-
-
Optionally, to add more details about the goal, click Description.
-
Sitecore Personalize automatically creates a Friendly ID as you enter a Goal name. You can use this ID to refer to the goal when integrating.
To edit the ID, click
and enter the new ID for the goal.
NoteWhen editing, use a-z, 0-9, and underscores for spaces.
-
Click Save. The goal is added to the Goals tile.
Custom goal snapshot
-
What it tracks - a numerical value derived from a custom event, such as a form submission, button click, or any other user-defined event.
-
Conversion - occurs when the user successfully triggers the custom event during their session and reaches the target custom value, such as a specified number of button clicks.
-
Attribution - identifies and credits the experiment that contributed to triggering the custom event and achieving the desired value.
-
Multi-touch example - if a user interacts with a personalized homepage, then navigates to the product category page, and clicks on at least 5 product items (the custom goal), each touchpoint is credited for triggering the custom event and reaching the target value.
Next steps
-
Start the experiment for personalization to take effect and for any variants to be potentially exposed to guests.
-
View the analytics. After starting the experiment, you can immediately see operational data. Within 24 hours, you'll see how your variants are performing against each other on the Performance screen. This lets you see which variant is leading or if a winner has been declared based on the goal.