Use DO_NOT_TRACK widget per-page type

  • Updated

You can configure and support multiple DO_NOT_TRACK (DNT) widgets for different page types in your site in Optimizely Product Recommendations. With a dedicated DNT widget tailored for each page type (like home, category, product, or custom pages), you can enjoy enhanced privacy compliance, improved widget management, and greater flexibility for complex site structures.   

Page type parameter

The tracking request requires a type parameter, which specifies the page type, like home, category, product, or custom pages. For standard pages, pass the following parameter, without passing the customPageName parameter:

type=[pageName]

For custom pages, pass the following parameters: 

type=other
customPageName=[customPageName]

If the type parameter is missing or invalid, the system returns a 400 Bad Request status. If type is other for a custom page, and customPageName is missing or invalid, the system returns a 400 Bad Request status again.

Widget management

Page type differentiates DNT widgets, letting you use multiple widgets with the same name like DO_NOT_TRACK but associated with different page types. This reduces the risk of naming errors and simplifies widget management.

You must update existing implementations to include the new parameters in tracking requests to ensure correct widget behavior.

Example tracking request

See the following example tracking request for a page type:

fetch("https://site.eu1.productrecs.optimizely.com/tracker/genericRecs.page?loc=en-GB&type=home, { method: 'GET'}).then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error('error', err));

For custom pages:

fetch("https://site.eu1.productrecs.optimizely.com/tracker/genericRecs.page?loc=en-GB&type=other&customPageName=myCustomPage, { method: 'GET'}).then(response => response.json()) .then(data => console.log(data)) .catch(err => console.error('error', err));