Docs
  • INTRO
    • What is Shoplift?
    • What to Test
    • Quickstart
      • Install Shoplift
      • Create a Test
      • Edit Your Variant
      • Launch Your Test
  • TEST
    • Template Testing
      • Overview
      • Guides
        • Guide: Testing Individual Pages
        • Guide: Testing One-Click Payment Methods
        • Guide: Testing App Blocks
        • Guide: Testing Different Template Types
      • Theme Compatibility
      • Template Management
      • Switching Themes
      • Shopify Markets
      • Shopify Translate & Adapt
    • Theme Testing
      • Overview
      • Guides
        • Guide: Testing a Navigation Menu
        • Guide: Testing a Mini Cart
      • Theme Management
      • Theme Development
      • Switching Themes
    • URL Testing
      • Overview
      • Guides
        • Guide: Testing URLs
        • Guide: Testing Product Properties
    • JavaScript API (Beta)
      • isHypothesisActive
      • setAnalyticsConsent
      • getVisitorData
    • Lift Assistâ„¢
      • What is Lift Assistâ„¢?
      • How To Use Lift Assistâ„¢
      • Brand Styles
    • Audience Targeting
      • Devices
      • New and Returning Visitors
      • Custom Audiences (UTMs, Referring Domains, and Geo-targeting)
    • Test Management
      • Test Compatibility
      • Mutual Exclusion
      • QA Checklist
      • Scheduling Tests
      • Pausing Tests
      • Implementing Winning Tests
    • Performance
      • Pagespeed
      • Shopify Caching
      • CDNs and Edge Delivery
  • ANALYZE
    • Reports
      • Overview
      • Metrics
        • Goals & Reporting Metrics
        • Metric Views
      • Test Progress
      • Statistical Significance
      • Channel Groups
    • Tracking
      • Visitor Attribution
      • Web Pixel
      • Liquid Snippet
      • Anti-Flicker
      • Analytics Discrepancies
  • integrate
    • Integrations and Tooling
      • GA4 (Beta)
        • Integrate GA4 (Shopify)
        • Integrate GA4 with Google Tag Manager
        • Integrate GA4 with Elevar
        • Analyze Test Data In Google Analytics
        • Disabling the GA4 Integration
      • Subscription Apps
      • Page Builder Apps
      • Reporting Tools
      • Heatmapping Tools
      • Custom Integrations
  • ADMIN
    • Plans and Billing
      • Subscription Plans
      • Uninstalling Shoplift
    • Users and Permissions
      • Managing Team Access
      • Managing User Notifications
    • Privacy and Compliance
      • Customer Data and GDPR
  • PARTNERS & DEVELOPERS
    • Shoplift Partner Program
    • Testing on Development Stores
  • SUPPORT
    • Frequently Asked Questions
    • Get Help
    • Give Feedback
Powered by GitBook

Contact Us

  • Get help
  • Give feedback
  • Request a feature

Helpful Links

  • Shoplift
  • Shopify App Store
On this page

Was this helpful?

  1. TEST
  2. JavaScript API (Beta)

getVisitorData

The getVisitorData() method is the primary way to check the current visitor's test state.

The getVisitorData() method takes 0 arguments, and returns a ExternalVisitorData representing whether the visitor's current test state.

ExternalVisitorData

Name
Type
Description

visitor

Visitor details

visitorTests

List of test information visitor is associated with

Visitor

Name
Type
Description

id

string

The unique id of the visitor

createdAt

Date

The date and time the visitor was created

shopifyAnalyticsId

string | null

The analytics id of the visitor defined by Shopify

device

"desktop" | "mobile"

The device used by the visitor

ExternalTestRelation

Name
Type
Description

createdAt

Date

The date and time when the visitor was associated with the test

testId

string

The id of the test a visitor is associated with

hypothesisId

string

The id of the test hypothesis a visitor is associated with

isThemeTest

boolean

Whether or not the test a visitor is associated with is a theme test

themeId

number | undefined

The themeId a visitor is associated with within a theme test

isSaved

boolean

Whether or not the visitor information has been saved to Shoplift

isInvalid

boolean | undefined

Whether or not a visitor and test association was attempted to be created during a test's paused or ended period

Example

const visitorData = window.shoplift.getVisitorData();
// Segment example
visitorData.visitorTests.forEach(vt => {
 analytics.track("Test Participation", {
    "shoplift_analytics_id": visitorData.shoplifyAnalyticsId,
    "test_id": vt.testId,
    "hypothesisId", vt.hypothesisId
  });
});
PrevioussetAnalyticsConsentNextLift Assistâ„¢

Last updated 4 months ago

Was this helpful?

| null

[]

Visitor
ExternalTestRelation