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