Ninetailed
Ask or search…
K
Comment on page

The Ninetailed Instance

Leverage methods and properties for accessing profile data and control experience rendering or tracking behaviour.
For most Ninetailed users, installing the appropriate React-based SDK, sending page, track, and identify events to enhance user profiles, and using the <Experience> component to render personalization and experiment content will be sufficient.
However, you may need to arbitrarily access profile data or exercise more control over how experiences are rendered and tracked. These needs arise when you need more control within a React web application or when you're not implementing Ninetailed within a web React context. The methods and properties available on Ninetailed class instances offer developers a great deal of flexibility to meet these needs.

Instance Properties

Property
Type Signature
Description
page, track, and identify
Essential methods of Ninetailed that submit events to the Experience API. See the dedicated documentation on these events
debug
(enable: boolean) => void
Turn debug mode on or off. Debug mode logs information about whether a a profile's assignment to an experience and its variants.
observeElement
(payload: ElementSeenPayload, options?: ObserveOptions) => void
Register a DOM element to be tracked by any plugins attached to the Ninetailed instance. Your plugin tracking events will fire when any part of the element has been visible within the user's viewport for at least the amount of time specified by the trackingComponentThreshold configuration option on the Ninetailed instance. Internally calls trackComponentView.
onIsInitialized
(onIsInitialized: () => void) => void
Supply a callback function to execute on instantiation of the class instance
onProfileChange
(cb: (profile: ProfileState) => void) => () => void
Supply a callback function that is executed each time the profile changes. The callback function has access to the changed profile.
Additionally, the callback function you supply will be immediately invoked when first calling onProfileChange using the current profile state.
plugins
NinetailedPlugin[]
Read the plugins attached to the Ninetailed instance and/or invoke any methods attached to them.
profileState
{ error: Error | null,
from: "api" | "hydrated", profile: Profile | null, status: "error" | "loading" | "success", }
Metadata about loading state of a profile and, once loaded, the current profile state.
trackComponentView
(properties: ElementSeenPayload) => Promise<void>
Immediately send any connected plugin tracking calls for a the supplied element. Called by observeElement.
unobserveElement
(element: Element) => void
Unregister an element for tracking. This is the clean up compliment to observeElement.