Page

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"). Learn more about pages.

Syntax

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

Parameters

Parameter and TypeChild AttributeDescription
page
PageObject
N/AThis is a page object.
type
string
Child attribute of type PageObjectThis is a static value that indicates that you're using the page function. Required.
pageName
string
Child attribute of type PageObjectThe "API name" for a page created in Optimizely Web Experimentation, e.g., product_detail. Choose the "manual activation" option in page creation to see or change this name. Required.
tags
PageTag
Child attribute of type PageObjectA single-level JSON object with metadata about the content on the page, e.g., the product being purchased.
*
string or integer
Child attribute of type PageTagYou 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
  }
});

Description

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").

Specifically, pushing a page has two effects:

  • Optimizely Web Experimentation will track 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 Optimizely Web Experimentation with URL targeting, but this API call allows you to 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.