Home > @uniformdev/context > Context

Context class

Signature:

Implements: ContextInstance

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the <code>Context</code> class

Properties

PropertyModifiersTypeDescription
events<code>readonly</code>{ on: { <Key extends keyof ContextEvents>): void; }; }Subscribe to events
manifest<code>readonly</code>ManifestInstance
quirks<code>readonly</code>Readonly<Quirks>Gets the current visitor's quirks values.
scores<code>readonly</code>Readonly<ScoreVector>Gets the current visitor's dimension score vector.
storage<code>readonly</code>VisitorDataStore

Methods

MethodModifiersDescription
forget(fromAllDevices)Forgets the visitor's data and resets the Context to its initial state.
getPersonalizeVariantControl(name, index)
getServerToClientTransitionState()<p>Computes server to client transition state.</p><p>Removes state from server-to-client if it came in initial state (cookies) to avoid double tracking on the client.</p>
getTestVariantId(testName)use test() instead
internal_processPersonalizationEvent(event)
internal_processTestEvent(event)
log(message)Writes a message to the Context log sink. Used by Uniform internal SDK; not intended for public use.
personalize(options)Executes a personalized placement with a given set of variants
processServerCommands({ serverCommands, commands, })
setTestVariantId(testName, variantId)use test() instead
test(options)Executes an A/B test with a given set of variants, showing the visitor's assigned variant (or selecting one to assign, if none is set yet)
update(newData)<p>Updates the Context with new data of any sort, such as new URLs, cookies, quirks, and enrichments.</p><p>Only properties that are set in the data parameter will be updated. Properties that do not result in a changed state, i.e. pushing the same URL or cookies as before, will NOT result in a recomputation of signal state.</p>