Guides
Submit Documentation FeedbackJoin Developer CommunityLog In

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 Type

Child Attribute

Description

page
PageObject

This 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 Optimizely, 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 PageObject

A 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 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
  }
});

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


Did this page help you?