Home > @uniformdev/context-react

context-react package

Functions

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

Function

</th><th>

Description

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

Personalize(props)

</td><td>

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

Test(props)

</td><td>

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

Track({ behavior, children, tagName, threshold, disableVisibilityTrigger, ...rest })

</td><td>

Tracks visitor behavior by adding enrichment score when they view content wrapped in this component. When the Track component is sufficiently in the viewport, it will trigger the enrichment values specified in behavior to the current visitor. If the browser does not support IntersectionObserver, the behavior will be triggered immediately on page load instead.

NOTE: this component necessarily renders a wrapping tag to attach the IntersectionObserver to; this can result in DOM changes when personalization is added. If that's undesirable use TrackFragment instead which tracks only on page load, but does not render a wrapping tag.

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

TrackFragment({ behavior, children })

</td><td>

Tracks visitor behavior by adding enrichment score when they are shown a route with this component on it.

NOTE: if you wish to track on the visitor seeing the content in the browser viewport instead, use Track instead of TrackFragment.

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

useQuirks()

</td><td>

Provides reactive access to the Uniform Context's current visitor quirks values This can be used when you want to read current quirk values directly.

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

useScores()

</td><td>

Provides reactive access to the Uniform Context's current visitor scores values. This can be used when you want to read current score values directly.

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

useUniformContext(options)

</td><td>

Gets the current Uniform Context object (must be within a UniformContext component ancestor)

IMPORTANT: The Context object's scores and quirks (i.e. context.scores) are NOT reactive when fetched with this hook. If you need reactive scores or quirks use useScores and useQuirks instead.

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

useUniformContext(options)

</td><td>

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

Interfaces

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

Interface

</th><th>

Description

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

TestComponentProps

</td><td>

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

UniformContextProps

</td><td>

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

Variables

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

Variable

</th><th>

Description

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

UniformContext

</td><td>

Registers Uniform Context with a React app (as a React Context!). Children of this component may use the Context via hooks, such as useScores and useUniformContext.

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

Type Aliases

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

Type Alias

</th><th>

Description

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

PersonalizeComponentProps

</td><td>

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

PersonalizedVariationComponent

</td><td>

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

PersonalizeWrapperComponent

</td><td>

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

TrackFragmentProps

</td><td>

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

TrackProps

</td><td>

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

TVariation

</td><td>

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

VariantOutputType

</td><td>

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