Score decay

The classification process depends on scores that are increased and decreased as a visitor engages with a website or other digital experience. While those scores are accurate at the time they're calculated, over time, they become less accurate. Uniform compensates for that by automatically reducing stale scores over time. This is described as "decay.

With default settings, Context doesn't perform decay but it's a simple addition to the configuration to add a decay algorithm. Context comes with a simple linear decay implementation that decays scores at a linear rate the longer a visitor is inactive. With default linear decay settings of a 1-day grace period, 30-day decay duration, and 95% decay cap for example:

  • Return visit in less than 1 day: no decay - within grace period
  • Return visit in 16 days: decay is 50% of total score in each dimension (1 day grace + 15 days is half of 30-day default decay rate)
  • Return visit in 31 days: decay is 95% of total score in each dimension (1 day grace + 30 days, decay cap 95%)

Uniform provides a decay function that reduces a score by the same amount every time it runs. The following example demonstrates how to activate linear decay.

import { Context, createLinearDecay, } from '@uniformdev/context'; const manifest = { project: {} }; const options = { decayRate: 0.1 }; const context = new Context({ manifest, consent: true, decay: createLinearDecay(options), });

This function creates a linear decay function that can be assigned to the Context. Linear decay involves reducing a score by the same amount each day the decay runs.

The following describes how decay works over time and with continuing engagement. Consider the following settings:

  • Scores will decay by 10% each day (decay rate).
  • The most a score will decay in a day is 95% (decay cap).
  • Decay will start after 1 day (grace period).
DayNew activityDecayTotal scoreNotes
11000100No decay due to grace period.
201090Decay is 10% of the previous day's score (100).
30981Decay is 10% of the previous day's score (90).
4208.192.9Decay is 10% of the previous day's score (81). Decay doesn't apply to the new activity score.
509.2983.61Decay is 10% of the previous day's score (92.9).


For more information on linear decay, see the package reference.

Coming soon