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

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 Type

Child Attribute

Description

page PageObject

N/A

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