Create ranking formulas create-ranking-formulas

On this page: Create ranking formulas with the AI formula builder that combine AI model scores, offer priorities, profile attributes, and contextual signals, so you can control which offer is presented first and align decisioning with both your business goals and your customers’ needs.

Ranking formulas allow you to define rules that determine which offer should be presented first, rather than taking into account the priority scores.

To create these rules, the AI formula builder in Adobe Journey Optimizer provides greater flexibility and control in how offers are ranked. Instead of relying only on a static offer priority, you can now define custom ranking formulas that combine AI model scores, offer priorities, profile attributes, offer attributes, and contextual signals through a guided interface.

This approach allows you to dynamically adjust offer ranking based on any combination of AI-driven propensity, business value, and real-time context, making it easier to align decisioning with both marketing goals and customer needs. The AI formula builder supports simple or advanced formulas depending on how much control you want to apply.

TIP
You can also create, explain, simulate, and optimize ranking formulas conversationally using the Decisioning Rule Workflow skill in Coworker for Decisioning.

Once a ranking formula has been created, you can assign it to a selection strategy. If multiple offers are eligible to be presented when using this selection strategy, the decisioning engine will use the selected formula to calculate which offer to deliver first.

➡️ Discover this feature in video

Guardrails and limitations ranking-guardrails

Before creating ranking formulas, keep the following constraints in mind:

  • The AI formula builder does not support personalized optimization models that use continuous metrics.
  • When an AI model is used in a ranking formula, data are not reflected in the Conversion rate for Holdout and Model Driven traffic report.
  • The nesting depth in a ranking formula is limited to 30 levels, measured by counting ) in the PQL string.
  • A ranking formula string can be up to 8KB for UTF-8 encoded characters (8,000 ASCII characters or 2,000-4,000 non-ASCII characters).
  • Lookback periods are not supported in ranking formulas (for example, experience events from the last month). Attempts to save such formulas trigger an error.
  • AI-powered formula optimization applies only to ranking formulas whose code-based PQL expression is larger than 2 KB in UTF-8 encoded size; smaller formulas are not analyzed.

Create the ranking formula and set properties create-ranking-formula

To create a ranking formula, follow the steps below.

  1. Access the Strategy setup menu, then select Ranking formulas tab. The list of previously created formulas is displayed.

  2. Click Create formula.

  3. Specify the formula name, and add a description if desired.

    {width="80%"}

  4. Optionally, click Select AI model to set the model that will be used as a reference to build your ranking formula.

    Every time you refer to a model score when defining your formula below, the AI model that you selected will be used.

  5. Define the conditions that will determine the ranking score for the matching decision items. You can:

Use Adobe Experience Platform data aep-data

In the Dataset lookup section, you can use data from Adobe Experience Platform to dynamically adjust the ranking logic to reflect real-world conditions.

This is especially useful for attributes that frequently change, such as product availability or real-time pricing. Learn how to use Adobe Experience Platform data for decisioning

Define criteria

Define criteria using the formula builder ranking-select-criteria

Define the criteria that will determine the ranking score for the matching decision items.

With an intuitive interface, you can fine-tune decisioning by adjusting AI scores (propensity), offer value (priority), contextual levers, and external profile propensities — individually or in combination — to optimize every interaction.

  1. If needed, click Switch to code editor to add an expression that uses PQL syntax alongside the formula builder. This option complements the user interface fields in the steps below, so you can combine both approaches in the same ranking formula. For more on how to use PQL syntax, refer to the dedicated documentation. Syntax for decision item attributes and copy-paste examples are provided in the Use the code editor section.

    note
    NOTE
    Switching to the code editor adds expression-based input to your criteria and does not remove the other user interface fields.
  2. In the Criterion 1 section, specify the decision items that you want to apply a ranking score to by doing the following:

    {width="70%"}

  3. Optionally, you can specify additional elements to refine the matching conditions for your criteria to be true.

    {width="80%"}

    For example, you defined Criterion 1 such as the Weather custom attribute Equals the warm condition. Additionally, you can add another condition such as if the first condition is met and if the temperature exceeds 75 degrees at the time of the request, then Criterion 1 is true.

  4. Create an expression that will assign a ranking score to the decision items that meet the condition defined above. You can reference any of the following:

    • the score that came out of the AI model that you optionally selected in the Details section above;
    • the decision item’s priority, which is a value manually assigned when creating a decision item;
    • any attribute that might live on the profile, such as any externally derived propensity score;
    • a static value that you can assign in a free format;
    • any combination of all the above.

    {width="70%"}

    note
    NOTE
    Click the icon next to the field to add predefined variables.
  5. Click Add criterion to add one or more criteria as many times as needed. The logic is as follows:

    • If the first criterion is true for a given decision item, it takes precedence over the next ones.
    • If not true, the decisioning engine moves on to the second criterion, and so on.
  6. In the last field, you can build an expression that will be assigned to all decision items that do not meet the above criteria.

    {width="70%"}

    accordion
    Ranking formula example

    {width="80%"}

    If the decision item’s region (custom attribute) equals the profile’s geographical label (profile attribute), the ranking score expressed here (which is a combination of the decision item priority, the AI model score and a static value) will be applied to all decision items meeting that condition.

  7. When your formula is ready, click Create.

You can now access the ranking formula from the list to view its details, and edit or delete it. It is ready to be used in a selection strategy to rank eligible decision items.

Define criteria using the code editor ranking-code-editor

Use Switch to code editor when you want to write or edit ranking logic as a PQL expression.

NOTE
This action will prevent you from reverting back to the default builder view for this formula.

You can leverage profile attributes, context data, and decision item attributes.

For example, you want to boost the priority of all offers with the “hot” attribute if the actual weather is hot. To do this, the contextData.weather=hot was passed in the decisioning call.

{width="80%"}

To leverage attributes related to your decision items in formulas, make sure you follow the correct syntax in your ranking formula’s code. Expand each section for more information:

Leverage decision items standard attributes
Leverage decision items custom attributes

You can create many different code-based ranking formulas according to your needs. Below are some examples.

Boost offers with certain offer attribute based on profile attribute

If the profile lives in the city corresponding to the offer, then double the priority for all offers in that city.

Ranking formula:

code language-none
if( offer.characteristics.get("city") = homeAddress.city, offer.rank.priority * 2, offer.rank.priority)
Boost offers where the end date is less than 24 hours from now

Ranking formula:

code language-none
if( offer.selectionConstraint.endDate occurs <= 24 hours after now, offer.rank.priority * 3, offer.rank.priority)
Boost offers based on the customers propensity to purchase the product being offered

You can boost the score for an offer based on a customer propensity score.

In this example, the instance tenant is _salesvelocity and the profile schema contains a range of scores stored in an array:

Given this, for a profile such as:

code language-none
{"_salesvelocity": {"individualScoring": [
                    {"core": {
                            "category":"insurance",
                            "propensityScore": 96.9
                        }},
                    {"core": {
                            "category":"personalLoan",
                            "propensityScore": 45.3
                        }},
                    {"core": {
                            "category":"creditCard",
                            "propensityScore": 78.1
                        }}
                    ]}
}

The decision items would contain a custom attribute, propensityType, that matches the category from the scores.

Your ranking formula can then set the score of each decision item to equal the customer’s propensityScore for that propensityType. If no score is found, use the static priority set on the decision item.

Ranking formula:

code language-none
let score = (select _Individual_Scoring1 from _salesvelocity.individualScoring
             where _Individual_Scoring1.core.category.equals(offer.characteristics.get("propensityType"), false)).head().core.propensityScore
in if(score.isNotNull(), score, offer.rank.priority)
Boost offers based on a profile's ZIP code and annual income

In this example, the system always tries to show a ZIP-matching offer first, and falls back to a general offer if no match is found, avoiding showing offers meant for other ZIP codes.

code language-pql
if( offer._luma.offerDetails.zipCode = _luma.zipCode,luma.annualIncome / 1000 + 10000, if( not offer.luma.offerDetails.zipCode,_luma.annualIncome / 1000, -9999) )

What the formula does:

  • If the offer has the same ZIP code as the user, give it a very high score so it gets picked first.
  • If the offer doesn’t have a ZIP code at all (it’s a general offer), give it a normal score based on the user’s income.
  • If the offer has a different ZIP code than the user, give it a very low score so it’s not selected.
Boost offers based on context data

Journey Optimizer allows you to boost certain offers based on the context data being passed in the call. For example, if the contextData.weather=hot is passed, the priority of all offers with attribute=hot must be boosted.

note
NOTE
For detailed information on how to pass context data, refer to this section.

Note that when using the Decisioning API, the context data is added to the profile element in the request body, such as in the example below:

code language-none
"xdm:profiles": [
{
    "xdm:identityMap": {
        "crmid": [
            {
            "xdm:id": "CRMID1"
            }
        ]
    },
    "xdm:contextData": [
        {
            "@type":"_xdm.context.additionalParameters;version=1",
            "xdm:data":{
                "xdm:weather":"hot"
            }
        }
    ]

}],

Simulate your ranking formula simulate-ranking-formula

Before applying a ranking formula to your selection strategy, you can test it with sample or generated data to validate the ranking results and ensure it delivers the expected behavior.

Access the simulation workspace

  1. Open an existing formula or create a new one then click the Simulate formula button.

  2. The simulation screen opens with several sections:

    • Test Variants: Where you generate or create manual test variants
    • Ranking expression: Displays the formula expression for reference
    • Simulation result: Shows ranked offers when a variant is selected

Add test variants

  1. Add test variants using one of the following methods:

    • To create a manual sample, select the Create sample button then select the offer items you want to use for testing.
    • To generate test variants using AI, click the Generate button.
    note
    NOTE
    AI-based test variant generation is available to organizations with access to Adobe AI capabilities.

The Test variants section is automatically populated with the selected items or generated samples. Each variant includes attributes used in your expression. You can edit the field values directly to simulate different scenarios.

Populate variants with Adobe Experience Platform test profiles

Once you have created or generated a variant, you can use attributes from existing Adobe Experience Platform test profile to populate its attributes.

  1. Select Edit on a variant then click the Select AEP profile button.

  2. Select an identity namespace, enter the corresponding identity value.

    The Recents area lists profiles that you have successfully applied. Recent profiles are stored in the browser per organization and sandbox, are ordered with the newest first, and are limited to 10 entries.

  3. Click the Select profile button. The test profile’s attributes are added to the selected variant.

View the simulation results

To view the ranking result of your simulation, select a test variant from the list. The Simulation result area displays the ranked offers with their scores, showing how your formula ranks the items based on the variant data.

For each selected variant, the simulation returns an ordered result:

  • The top-ranked offers are those with the highest computed scores for that variant.
  • Lower-ranked offers remain eligible but are ordered after higher-scoring offers.

AI-powered formula optimization optimize

Journey Optimizer can automatically analyze ranking formulas and suggest simplifications that preserve the original logic. Only formulas whose PQL expression is larger than 2 KB (UTF-8 encoded) are eligible, smaller expressions are not analyzed. When a simplification is found, a red indicator appears next to the formula name in the list.

NOTE
AI-powered formula optimization relies on the same generative AI capabilities as Generate Content, and uses the same access controls. Users must be granted the Generate Content permission on the AI Assistant resource. For details, refer to Access Generate Content.

To optimize a ranking formula:

  1. In the ranking formulas list, click the red indicator icon next to the formula name.

  2. The Optimize window opens, displaying the original PQL expression alongside the AI-suggested version.

  3. To validate that both expressions produce identical ranking results, click Download Optimisation Analysis (TSV) to download a file showing how simulated profiles are evaluated against each version.

  4. Once satisfied, click Apply to replace the original expression with the optimized one.

How-to video video

Learn how to use the AI Formula Builder in Adobe Journey Optimizer to create custom offer ranking strategies.

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: Shows how to create, with the AI formula builder, ranking formulas that combine AI model scores, offer priorities, profile attributes, offer attributes, and contextual signals to control which offer is presented first, and how to simulate a formula and use AI-powered formula optimization.

Intents:

  • Create a ranking formula from the Ranking formulas tab of the Strategy setup menu (formula name, optional description, optional AI model), then view its details, and edit or delete it from the list.
  • Define the criteria that determine the ranking score for the matching decision items with the formula builder and/or the code editor (PQL).
  • Use data from Adobe Experience Platform, in the Dataset lookup section, to adjust the ranking logic to reflect real-world conditions.
  • Simulate a ranking formula with test variants before applying it to a selection strategy, and read the ranked offers with their scores.
  • Use AI-powered formula optimization to compare an AI-suggested simplification with the original PQL expression and apply it.
  • Find copy-paste PQL examples of ranking formulas.

Glossary:

  • Ranking formula (product-specific): a rule that determines which offer should be presented first. Once created, it can be assigned to a selection strategy; if multiple offers are eligible to be presented when using this selection strategy, the decisioning engine uses the selected formula to calculate which offer to deliver first.
  • AI formula builder (product-specific): provided in Adobe Journey Optimizer to define custom ranking formulas through a guided interface; it supports simple or advanced formulas depending on how much control you want to apply.
  • Formula builder: the intuitive interface used to fill in the Criteria section, to fine-tune decisioning by adjusting AI scores (propensity), offer value (priority), contextual levers, and external profile propensities, individually or in combination.
  • Code editor (Switch to code editor): used to define or refine ranking logic as a PQL expression. In the formula builder steps, it adds an expression that uses PQL syntax alongside the formula builder and complements the user interface fields, so that you can combine both approaches in the same ranking formula. In the code editor you can leverage profile attributes, context data, and decision item attributes.
  • PQL (product-specific): the syntax used for expressions in the code editor; the page links to dedicated documentation on how to use PQL syntax.
  • Criterion (formula builder): Criterion 1 specifies the decision items that you want to apply a ranking score to: you select a decision item attribute, select a logical operator, and add a matching condition (type a value, or select a profile attribute or context data). Additional elements can optionally refine the matching conditions. An expression then assigns a ranking score to the decision items that meet the condition; it can reference the score from the AI model that you optionally selected, the decision item’s priority (a value manually assigned when creating a decision item), any attribute that might live on the profile (such as any externally derived propensity score), a static value assigned in a free format, or any combination of these. If the first criterion is true for a given decision item, it takes precedence over the next ones; if not true, the decisioning engine moves on to the second criterion, and so on. In the last field, an expression is assigned to all decision items that do not meet the criteria.
  • AI model (Select AI model): optional; sets the model used as a reference to build the ranking formula; every time you refer to a model score when defining the formula, the AI model that you selected is used.
  • Dataset lookup (product-specific): section in which you can use data from Adobe Experience Platform to dynamically adjust the ranking logic to reflect real-world conditions; it is especially useful for attributes that frequently change, such as product availability or real-time pricing.
  • Simulate formula: opens the simulation screen, where, before applying a ranking formula to a selection strategy, you can test it with sample or generated data to validate the ranking results and ensure it delivers the expected behavior. The screen has three sections: Test Variants (where you generate or create manual test variants), Ranking expression (displays the formula expression for reference), and Simulation result (shows ranked offers with their scores when a variant is selected). For each selected variant, the top-ranked offers are those with the highest computed scores for that variant, and lower-ranked offers remain eligible but are ordered after higher-scoring offers.
  • Test variants: a manual sample (Create sample, using the offer items you select for testing) or variants generated with AI (Generate); each variant includes attributes used in your expression, and you can edit the field values directly to simulate different scenarios. Once created or generated, a variant can be populated with attributes from an existing Adobe Experience Platform test profile (Select AEP profile, then Select profile).
  • AI-powered formula optimization (product-specific): Journey Optimizer can automatically analyze ranking formulas and suggest simplifications that preserve the original logic; when a simplification is found, a red indicator appears next to the formula name in the list. The Optimize window displays the original PQL expression alongside the AI-suggested version; Download Optimisation Analysis (TSV) downloads a file showing how simulated profiles are evaluated against each version, to validate that both expressions produce identical ranking results; Apply replaces the original expression with the optimized one.

Guardrails:

  • The AI formula builder does not support personalized optimization models that use continuous metrics.
  • When an AI model is used in a ranking formula, data are not reflected in the Conversion rate for Holdout and Model Driven traffic report.
  • The nesting depth in a ranking formula is limited to 30 levels (hard limit), measured by counting ) in the PQL string.
  • A ranking formula string can be up to 8KB (hard limit) for UTF-8 encoded characters (8,000 ASCII characters or 2,000-4,000 non-ASCII characters).
  • Lookback periods are not supported in ranking formulas (for example, experience events from the last month); attempts to save such formulas trigger an error.
  • AI-powered formula optimization applies only to ranking formulas whose code-based PQL expression is larger than 2 KB in UTF-8 encoded size; smaller formulas are not analyzed.
  • Switch to code editor: this action will prevent you from reverting back to the default builder view for this formula.
  • Select AEP profile, Recents area: recent profiles are stored in the browser per organization and sandbox, are ordered with the newest first, and are limited to 10 entries (hard limit).

Prerequisites and permissions:

  • AI-powered formula optimization: users must be granted the Generate Content permission on the AI Assistant resource; it relies on the same generative AI capabilities as Generate Content and uses the same access controls.
  • AI-based test variant generation (the Generate button of the simulation): available to organizations with access to Adobe AI capabilities.

Terminology:

  • Canonical name: Ranking formulas — variants: ranking formula, formula (as in the Create formula and Simulate formula buttons)
  • Canonical name: Adobe Experience Platform — Acronym: AEP
  • Canonical name: Adobe Journey Optimizer — Acronym: AJO — variants: Journey Optimizer
  • Do not confuse: “ranking formula” ≠ “static offer priority” — the page says that instead of relying only on a static offer priority, you can define custom ranking formulas; offer priorities are one of the elements that a ranking formula can combine.

FAQ:

  • Can I combine the formula builder and PQL in the same ranking formula? Yes. Switch to code editor adds an expression that uses PQL syntax alongside the formula builder and complements the user interface fields, so you can combine both approaches in the same ranking formula; it does not remove the other user interface fields. This action will prevent you from reverting back to the default builder view for this formula.
  • What are the nesting depth and size limits of a ranking formula? The nesting depth is limited to 30 levels (hard limit), measured by counting ) in the PQL string, and a ranking formula string can be up to 8KB (hard limit) for UTF-8 encoded characters (8,000 ASCII characters or 2,000-4,000 non-ASCII characters).
  • Are lookback periods supported in ranking formulas? No. Lookback periods are not supported in ranking formulas (for example, experience events from the last month), and attempts to save such formulas trigger an error.
  • Does the AI formula builder support personalized optimization models? The AI formula builder does not support personalized optimization models that use continuous metrics.
  • Which ranking formulas does AI-powered formula optimization analyze? It applies only to ranking formulas whose code-based PQL expression is larger than 2 KB in UTF-8 encoded size; smaller formulas are not analyzed. Users must be granted the Generate Content permission on the AI Assistant resource.
  • How can I test a ranking formula before applying it to a selection strategy? Use Simulate formula to test it with sample or generated data: add test variants with Create sample (manual sample) or Generate (AI-based test variant generation, available to organizations with access to Adobe AI capabilities), then select a variant to see the ranked offers with their scores in the Simulation result area.

Examples:

  • Formula builder, additional condition: Criterion 1 is the Weather custom attribute Equals the warm condition; you can add another condition such as: if the first condition is met and the temperature exceeds 75 degrees at the time of the request, then Criterion 1 is true.

  • Formula builder, ranking formula example: if the decision item’s region (custom attribute) equals the profile’s geographical label (profile attribute), the ranking score expressed in the example (a combination of the decision item priority, the AI model score and a static value) is applied to all decision items meeting that condition.

  • Code editor, boost offers with a certain offer attribute based on a profile attribute: if the profile lives in the city corresponding to the offer, then double the priority for all offers in that city: if( offer.characteristics.get("city") = homeAddress.city, offer.rank.priority * 2, offer.rank.priority)

  • Code editor, boost offers where the end date is less than 24 hours from now: if( offer.selectionConstraint.endDate occurs <= 24 hours after now, offer.rank.priority * 3, offer.rank.priority)

  • Code editor, boost offers based on the customer’s propensity to purchase the product being offered: the instance tenant is _salesvelocity and the profile schema contains a range of scores stored in an array.

    • Sample profile: the _salesvelocity.individualScoring array holds core.category / core.propensityScore pairs: insurance / 96.9, personalLoan / 45.3, creditCard / 78.1.
    • The decision items contain a custom attribute, propensityType, that matches the category from the scores; the ranking formula can then set the score of each decision item to equal the customer’s propensityScore for that propensityType; if no score is found, use the static priority set on the decision item.
    • Formula: let score = (select _Individual_Scoring1 from _salesvelocity.individualScoring where _Individual_Scoring1.core.category.equals(offer.characteristics.get("propensityType"), false)).head().core.propensityScore in if(score.isNotNull(), score, offer.rank.priority)
  • Code editor, boost offers based on a profile’s ZIP code and annual income: the system always tries to show a ZIP-matching offer first, and falls back to a general offer if no match is found, avoiding showing offers meant for other ZIP codes: if( offer._luma.offerDetails.zipCode = _luma.zipCode,luma.annualIncome / 1000 + 10000, if( not offer.luma.offerDetails.zipCode,_luma.annualIncome / 1000, -9999) )

    • If the offer has the same ZIP code as the user, give it a very high score so it gets picked first.
    • If the offer does not have a ZIP code at all (it is a general offer), give it a normal score based on the user’s income.
    • If the offer has a different ZIP code than the user, give it a very low score so it is not selected.
  • Code editor, boost offers based on context data: if contextData.weather=hot is passed in the call, the priority of all offers with attribute=hot must be boosted. With the Decisioning API, the context data is added to the profile element in the request body, in xdm:contextData of an xdm:profiles element, for example "@type":"_xdm.context.additionalParameters;version=1" with "xdm:data":{"xdm:weather":"hot"}.

Related pages:

Personas:

  • marketer: Can create a ranking formula from the Ranking formulas tab of the Strategy setup menu, then assign it to a selection strategy. Can define the criteria that determine the ranking score with the formula builder and/or the code editor (PQL). Can reference the score of the optionally selected AI model, the decision item priority, any profile attribute, a static value, or any combination. Can test a formula with Simulate formula before applying it to a selection strategy, using test variants added with Create sample or Generate. Can use AI-powered formula optimization to compare the original PQL expression with the AI-suggested version, then select Apply to replace the original expression. The page states that switching to the code editor prevents you from reverting back to the default builder view for this formula. The page states that lookback periods are not supported in ranking formulas and that attempts to save such formulas trigger an error. The page states that AI-powered formula optimization applies only to formulas whose PQL expression is larger than 2 KB in UTF-8 encoded size. The page states that users must be granted the Generate Content permission on the AI Assistant resource for AI-powered formula optimization. The page states that AI-based test variant generation is available to organizations with access to Adobe AI capabilities. Where: “Create ranking formulas”.

Onboarding:

  • Level: Intermediate
  • First minimal step: Access the Strategy setup menu, then select the Ranking formulas tab.
  • Success check: After you select Create, you can access the ranking formula from the list to view its details, and edit or delete it. It is ready to be used in a selection strategy to rank eligible decision items.
  • Next: Once a ranking formula has been created, it can be assigned to a selection strategy: selection strategy
recommendation-more-help
journey-optimizer-help