window.shoplift
Availability
// The object exists on window after script initialization
typeof window.shoplift // 'object' when loaded, 'undefined' before
// Always guard access
if (window.shoplift) {
// Safe to use
}Object Shape
interface ShopliftPublic {
/**
* Check if the current visitor is assigned to a specific hypothesis.
* Returns true if the visitor is assigned to the given hypothesis,
* false otherwise (control, different variant, test inactive, etc.).
*/
isHypothesisActive(hypothesisId: string): Promise<boolean>;
/**
* Manually set visitor analytics consent.
* Only needed for custom consent management platforms.
*/
setAnalyticsConsent(consent: boolean): Promise<void>;
/**
* Retrieve visitor information and test assignments.
* Synchronous — returns data immediately.
*/
getVisitorData(): ExternalVisitorData;
}Methods
Method
Purpose
Returns
Async
Loading Behavior
Waiting for the Object
Polling
Inline Guard
Error Handling
Browser Compatibility
TypeScript
Last updated
Was this helpful?