Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev GuideRecipesAPI ReferenceChangelogDiscussions
Dev GuideAPI ReferenceUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
API Reference

Visitor

Optimizely Web Experimentation uses visitor attributes for targeting and segmentation. The visitor object contains all the attributes that can be used for targeting and segmentation.

Syntax

visitor = window["optimizely"].get("visitor");

Parameters

Parameter and Type

Child Attribute

Description

visitor string

N/A

The argument indicating to get visitor information. Required.

Return value

Parameter and Type

Child Attribute

Description

VisitorData

N/A

The object contains all the attributes that can be used for targeting and segmentation.

browserId
string

Child attribute of type VisitorData

A unique identifier for the browser type.

browserVersion
string

Child attribute of type VisitorData

The version of the browser.

source_type
string

Child attribute of type VisitorData

Optimizely Web Experimentation evaluates how a visitor came to the website based on the referrer value. Possible values are direct, search, and referral.

visitorId
string

Child attribute of type VisitorData

A unique ID that Optimizely Web Experimentation uses to identify a visitor.

custom
objecttor = window["optimizel

Child attribute of type VisitorData

An object whose keys are custom attribute IDs and whose values are CustomAttributeObjects. Contains values for all custom attributes that have been set for the visitor.

id
string

Child attribute of type CustomAttributeObject

The ID of the custom attribute, as displayed in the Audiences > Attributes dashboard.

value
string

Child attribute of type CustomAttributeObjec

The value of the custom attribute as set for the current visitor.

  • *

Child attribute of type VisitorData

This object can contain project- or environment-specific properties that are not predefined.

Example Call

visitor = window["optimizely"].get("visitor");

Example Return Value

{
  "browserId": "gc",
  "browserVersion": "53.0.2785.143",
  "source_type": "referral",
  "visitorId": "oeu1476217818972r0.36434468013549726",
  "custom": {
    "7973492630": {
      "id": "7973492630",
      "value": "High Tech"
    },
    "7995780411": {
      "id": "7995780411",
      "value": "commercial 1"
    }
  }
}