Tags
Tags are contextual metadata about pages and events. They identify what a user is looking at, clicking on, or interacting with. For example, you can use tags to describe a product being purchased, an article being read, or a flight being booked. See Tags: Describe key elements on your site.
The following are three ways to capture this context:
- Directly on an event, using the tags property.
- Directly on a page, using the tags property. These tags are sent along with any event that happens on that page.
- The tags method to add context without activating a page and tracking a pageview. This is equivalent to the previous option, but can be used when pages are already being activated using URL targeting.
Syntax
window["optimizely"].push(tag);Parameters
Parameter and Type | Child Attribute | Description |
|---|---|---|
tag TagObject | N/A | This is a tag object. |
type string | Child attribute of type TagObject. | This is a static value that indicates that you are using the tag function. Required. |
tags PageTag | Child attribute of type TagObject. | A single-level JSON object with metadata. This is equivalent to page tags, but it can be used when pages are already being activated using URL targeting. |
* string or integer | Child attribute of type PageTag. | You can specify additional properties of your choice. |
Example call
window["optimizely"].push({
"type": "tags",
"tags": {
"category": "Kitchen",
"subcategory": "Blenders",
"price": 64999,
"sku": 113757
}
});