Home > @uniformdev/context > Context

Context class

Signature:

Implements: ContextInstance

Constructors

<table><thead><tr><th>

Constructor

</th><th>

Modifiers

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

(constructor)(options)

</td><td>

</td><td>

Constructs a new instance of the Context class

</td></tr> </tbody></table>

Properties

<table><thead><tr><th>

Property

</th><th>

Modifiers

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

events

</td><td>

readonly

</td><td>

{ on: { <Key extends keyof ContextEvents>): void; }; }

</td><td>

Subscribe to events

</td></tr> <tr><td>

manifest

</td><td>

readonly

</td><td>

ManifestInstance

</td><td>

</td></tr> <tr><td>

quirks

</td><td>

readonly

</td><td>

Readonly<Quirks>

</td><td>

Gets the current visitor's quirks values.

</td></tr> <tr><td>

scores

</td><td>

readonly

</td><td>

Readonly<ScoreVector>

</td><td>

Gets the current visitor's dimension score vector.

</td></tr> <tr><td>

storage

</td><td>

readonly

</td><td>

VisitorDataStore

</td><td>

</td></tr> </tbody></table>

Methods

<table><thead><tr><th>

Method

</th><th>

Modifiers

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

forget(fromAllDevices)

</td><td>

</td><td>

Forgets the visitor's data and resets the Context to its initial state.

</td></tr> <tr><td>

getPersonalizeVariantControl(name, index)

</td><td>

</td><td>

</td></tr> <tr><td>

getServerToClientTransitionState()

</td><td>

</td><td>

Computes server to client transition state.

Removes state from server-to-client if it came in initial state (cookies) to avoid double tracking on the client.

</td></tr> <tr><td>

getTestVariantId(testName)

</td><td>

</td><td>

use test() instead

</td></tr> <tr><td>

internal_processPersonalizationEvent(event)

</td><td>

</td><td>

</td></tr> <tr><td>

internal_processTestEvent(event)

</td><td>

</td><td>

</td></tr> <tr><td>

log(message)

</td><td>

</td><td>

Writes a message to the Context log sink. Used by Uniform internal SDK; not intended for public use.

</td></tr> <tr><td>

personalize(options)

</td><td>

</td><td>

Executes a personalized placement with a given set of variants

</td></tr> <tr><td>

setTestVariantId(testName, variantId)

</td><td>

</td><td>

use test() instead

</td></tr> <tr><td>

test(options)

</td><td>

</td><td>

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)

</td></tr> <tr><td>

update(newData)

</td><td>

</td><td>

Updates the Context with new data of any sort, such as new URLs, cookies, quirks, and enrichments.

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.

</td></tr> </tbody></table>