setPageType
The setPageType method sends to Monetate the page type for a page that a site visitor is viewing. This information allows you to limit actions to specific page types when you add action conditions to Web experiences and are an alternative to manual URL targeting.
You can use the setPageType method on all page types of your site.
For example, if you want to display a hero banner only on your site's home page, then you must consider all of the following URLs:
- http://example.com
- http://example.com/
- https://example.com
- https://example.com/
- http://www.example.com
- http://www.example.com/
- https://www.example.com
- https://www.example.com/
By defining a page type rather than using a target for all of the possible URLs, you can reliably target visitors with pagetype=main.
You can pass any string value for page type, but Monetate recommends using a single lowercase word as the value because the values are then easier to remember.
Do not include whitespaces in a page type value.
Refer to the following sections in Baseline API Call Matrix for recommended page types:
You can use setPageType with the addCategories method. This approach may be useful if you want to target site visitors viewing the Shirts category on a product listing page with a special offer.
This screenshot shows the Components tab of the Monetate Inspector browser plug-in. The Page Type row indicates that the setPageType method is passing the value main.
This code example contains the method in use that results in the Monetate Inspector results shown in the previous screenshot.