Visitor ID

Get the visitor ID assigned by Optimizely Web Experimentation.

Syntax

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

Parameters

Parameter and TypeChild AttributeDescription
visitor_id
string
N/AThe argument indicating to get visitor_id information. Required.

Return value

Parameter and TypeChild AttributeDescription
VisitorIdsObjectN/AThe visitor ID object contains the visitor ID assigned by Optimizely Web Experimentation.
randomId
string
Child attribute of type VisitorIdsObjectA randomly generated user ID for the current visitor, which is used by Optimizely Web Experimentation for calculating your results.

Example Call

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

Example Return Value

{
  "randomId": "oeu1470101898133r0.04568111757824678"
}