> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
> Use this file to discover all available pages before exploring further.

# User Affinity

> Personalize collection browsing in Layers by lifting products that match each shopper's learned tastes from their own cart and purchase history.

## Overview

User Affinity is a sort expression that personalizes browse results for each individual shopper. It appears in the **Add Expression** menu as **User Affinity** with a **New** badge.

Like [Soft Boost](/platform/sorting/soft-boost), User Affinity does **not** sort on its own — it is a modifier that lifts products matching the current shopper's learned tastes *within* the next sort expression below it. Because it always modifies a following sort attribute, **User Affinity cannot be the last expression in a sort order**: it requires a sort attribute beneath it to modify.

User Affinity only ever **promotes** matching products. It never demotes — products that don't match a shopper's affinities keep their organic position.

<Note>
  User Affinity is **browse personalization**. It applies on collection and browse pages, not on search results.
</Note>

## How User Affinity works

As a shopper browses, Layers builds a lightweight picture of their tastes from their own activity. When that shopper loads a collection that uses a User Affinity expression, products that match their inferred preferences are lifted up within the underlying sort, while everything else stays in its organic order.

If a shopper has **no learned affinities yet** — for example, a brand-new visitor — the expression is automatically skipped and the base sort applies unchanged. Shoppers always see a complete, sensibly ordered collection.

### Signals

Affinities are learned from each shopper's own **cart adds** and **purchases** within their session context:

* **Purchases weigh more heavily than cart adds.** A completed purchase is a stronger signal of taste than an item a shopper added to their cart.
* Signals are interpreted in the shopper's session context, so the personalization reflects that shopper's recent behavior.

### Eligible attributes

Affinities are powered only by attributes in the **Categorical** and **Feature** [attribute classes](/platform/attributes/attribute-classes). These are the attributes that describe what a product *is* — brand, color, material, product type, size, and similar characteristics — so matching reflects the kinds of products a shopper gravitates toward.

If a store has no categorical or feature attributes, User Affinity is unavailable. When you add the expression, the form shows how many categorical and feature attributes currently power affinities.

### Affinity weights

The **Affinity Weights** picker lets you choose which categorical and feature attributes drive matching and tune a per-attribute weight. Raise the weight on the attributes that matter most for your catalog (for example, brand for a multi-brand store, or material for an apparel store) and lower or disable attributes that are less meaningful.

## Configuration parameters

User Affinity reuses the same boost-mode model as [Soft Boost](/platform/sorting/soft-boost).

### Boost mode

Determines how matching products are lifted within the underlying sort.

* **Amplify strong performers** (multiplicative) — pushes matching products that *already* rank well on the underlying metric even higher. Use this when matches have real metric data, so personalization reinforces proven performers.
* **Lift matches into view** (additive) — surfaces matching products regardless of their metric value. Use this for new arrivals, restocks, or products with little performance data, where you want affinity matches to appear even without a strong base score.

The UI defaults to **Amplify strong performers**.

### Boost strength

A global multiplier on the affinity lift. Higher values produce a stronger personalization effect; lower values keep the lift subtle so organic ranking remains dominant.

### Percentile target

*Additive mode only.* The percentile that matching products are lifted toward, expressed against the underlying metric. A higher percentile lifts affinity matches further up the results.

### Min positions between / decay rate

Anti-clumping spacing controls. These keep affinity matches from bunching together so personalized results still feel varied across the page.

### Direction

Controls the direction of the affinity lift relative to the underlying sort.

## Preview as a shopper

You don't have to wait for live traffic to see how User Affinity behaves. The **Preview profile** shopper picker lets you simulate a shopper's cart and purchase products, then preview how User Affinity reorders a collection for that profile.

When you select or build a profile, the preview shows:

* The reordered collection as that shopper would see it, with affinity matches lifted into place.
* A plain-language summary of the shopper's inferred preferences, so you can sanity-check that the affinities make sense before publishing.

Use this to compare how the same collection looks for different kinds of shoppers and to confirm your **Affinity Weights** and boost settings produce the experience you intend.

## Best practices

* **Always leave a sort attribute beneath it.** User Affinity modifies the expression below it, so it can never be the last expression in the sort order.
* **Pick the right boost mode.** Use **Amplify strong performers** when affinity matches already have metric data, and **Lift matches into view** for new arrivals or low-data products you still want personalized into view.
* **Tune Affinity Weights to your catalog.** Emphasize the categorical and feature attributes that best capture taste in your store and de-emphasize the rest.
* **Preview across profiles.** Use **Preview profile** to simulate several shopper types before publishing, and confirm the inferred-preference summary matches your intent.
* **Start subtle.** Begin with a modest boost strength so personalization complements your organic ranking rather than overwhelming it.

## See also

* [Soft Boost](/platform/sorting/soft-boost) — the same boost-mode model, condition-based rather than personalized
* [Attribute classes](/platform/attributes/attribute-classes) — the categorical and feature classes that power affinities
* [Preview & annotations](/platform/sorting/preview) — preview sort orders and simulate shopper profiles
* [Sort orders](/platform/sorting) — full guide to creating and managing sort orders
