Share via


CSFScoreDiscounts

Use the CSFScoreDiscounts pipeline component in discount promotion selection to adjust scores of discount items to promote discounts most relevant to the current user.

Intended use: Content Selection pipeline, Scoring stage.

Values Read

The CSFScoreDiscounts pipeline component reads the following values from the indicated dictionaries.

Key

Dictionary

Description

_content.required_exprs

Order

The required expressions built on User and Context profiles. This is an array of expression IDs that must be True; otherwise the discount is assigned a score of zero (0).

_content.condition_expr

Order

The discount condition expression.

_content.award_expr

Order

The award condition expression.

_content.date_start

Order

The date the discount becomes active.

_content.date_end

Order

The date the discount expires.

Evaluator

Context

A reference to the Expression Evaluator component to use.

TargetingProfiles

Context

A dictionary that describes all of the profiles to target.

UserProfile

Context

Optional. A reference to a ProfileObject Object containing the user profile for the current user that is used in expression evaluation.

ContextProfile

Context

Optional. The ContentSelector Object (a dictionary) used in expression evaluation.

A SimpleList Object of dictionaries can also be read from the ContextProfile object from a key named Products. Typically, this is a list of the products the user is viewing or browsing (on the current page, for example). This product list should have the same format as the items list in the Order dictionary after the QueryCatalogInfo component has been run on it, making all product attributes available for discount expressions.

ContextProfile.items

Context

Optional. A SimpleList of the items in the customer's basket. Each item in the SimpleList is a dictionary that describes the catalog properties of a LineItem. This is the format that the QueryCatalogInfo pipeline component creates.

ContextProfile.products

Context

Optional. A SimpleList of the products to target, which is often the products on the current page. Each item in the SimpleList is a dictionary that describes the catalog properties of a LineItem. This is the format that the QueryCatalogInfo pipeline component creates.

Trace

Context

Optional. A Boolean indicating whether score adjustment tracing is enabled. This component will not produce trace strings unless this key is set to True.

Values Written

The CSFScoreDiscounts component writes the following value to the Order dictionary.

Key

Description

_content.score

A reference to the ContentList Object. The score key of each content item in the object is assigned a value.

Remarks

The CSFScoreDiscounts pipeline component adjusts the score of discount content items with the goal of promoting discounts most relevant to the current user. The algorithm is based on the following considerations:

  • The start and end dates of the discount. If the discount has not started, or has expired, it is disqualified.

  • Whether the item to be discounted is in the shopping basket.

  • Whether the item to be discounted is on the page being viewed (in the products list).

The following table lists the multipliers used based on the various combinations of the conditions and awards being met in the basket, in the products list, or not met. A condition or award being "met" means that the expression evaluates to True, but not necessarily that the cost or quantity amount was met. More than one entry in the table below may be met. The first one met is the one applied.

Condition

Award

Multiplier

Description

Met in basket

Applies to all (or free shipping)

0.5

The user is already receiving the benefit of the discount.

Met in basket

Met in basket

0.5

The user is already receiving the benefit of the discount.

Met in basket

Met in products

1.6

The user has half the discount in the basket, and is in the part of the site with the other half.

Met in basket

Not met

1.4

The user has half the discount in the basket.

Met in products

Applies to all (or free shipping)

1.2

The user is in the part of the site with half the discount.

Met in products

Met in basket

1.6

The user has half the discount in the basket, and is in the part of the site with the other half.

Met in products

Met in products

1.4

The user is in the part of the site with both halves of the discount.

Met in products

Not met

1.2

The user is in the part of the site with half the discount.

Not met

Applies to all (or free shipping)

1.0

Neutral context.

Not met

Met in basket

1.4

The user has half the discount in the basket.

Not met

Met in products

1.2

The user is in the part of the site with half the discount.

Not met

Not met

1.0

Neutral context.

The OrderDiscount pipeline component applies the discounts whose scores are adjusted by the CSFScoreDiscounts pipeline component. The CSFScoreDiscounts pipeline component saves the scores in the ContentList object held by the CacheManager Object. That ContentList object is then used by the OrderDiscount component in another pipeline.

See Also

Other Resources

Discount Objects

CSFLoadDiscounts

OrderDiscount (PCR)

Pipeline Component Reference