Tags are contextual metadata about pages and events. They identify what a user is looking at, clicking on, or interacting with.
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're 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
}
});
Description
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. Learn more about tags.
There are three ways to capture this context:
- Directly on an
event
, using thetags
property. - Directly on a
page
, using thetags
property. These tags will be sent along with any event that happens on that page. - Finally, you can use this
tags
method directly 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.