The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.
Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
API Reference

Page

The page method tracks the visitor's current context on a website.

The page method tracks the visitor's current context on a website. This context is used for both analytics ("track the number of views to the checkout page") and targeting ("run this experiment on the checkout page"). See Pages and URL targets.

Specifically, pushing a page has two effects:

  • Web Experimentation tracks a pageview event for this page, incrementing the count of views to that page in analytics and recording the event in the user's behavioral profile.
  • Any campaigns targeted to this page will be activated.

Pages can be created visually in Web Experimentation with URL targeting, but this API call lets you manually activate a page. This allows full flexibility for sites with dynamic content or challenging URL patterns.

Page information is reset whenever the browser reloads.

Syntax

window["optimizely"].push(page);

Parameters

Parameter and TypeChild AttributeDescription
page
PageObject
N/AThis is a page object.
type
string
Child attribute of type PageObject.This is a static value that indicates that you're using the page function. Required.
pageName
string
Child attribute of type PageObject.The "API name" for a page created in Web Experimentation, for example, product_detail. Choose the "manual activation" option in page creation to see or change this name. Required.
tags
PageTag
Child attribute of type PageObject.A single-level JSON object with metadata about the content on the page, for example, the product being purchased.
*
string or integer
Child attribute of type PageTag.You can specify additional properties of your choice.

Example call

window["optimizely"].push({
  "type": "page",
  "pageName": "watchedVideo",
  "tags": {
    "category": "Kitchen",
    "subcategory": "Blenders",
    "price": 64999,
    "sku": 113757
  }
});