Context-Based Page Detection

Prerequisite: Set your page context as described in Page Context for Web.

Loading of page elements is monitored, even when the page itself does not fully reload. This is done using a Web API called MutationObserver, which provides hooks into DOM mutations and enables us to track when a DOM node is inserted, destroyed or modified. With that, Dynamic Yield applies (or reapplies) changes at the right moment. When the page deactivates, Dynamic Yield no longer attempts to change the elements on that page.

The Dynamic Yield script has a state machine, and all of the campaigns are stateful smart objects. This way, the script responds to changes in your applications.



  • If auto-detect rules (context rules) are enabled for a specific page type, the page context implemented on this page type serves as a fallback if all rules don't apply.
  • A page refresh is required to assign users to CRM-based audiences.

Multiple methods are used to detect page changes:

  • URL changes are detected using the History API and Hashchange events.
    URL change detection ignores changes to URL query string parameters.
  • Changes in the Title tag in the page Head, or edits to Document.Title.
  • Context changes are detected by edits to the DY.recommendationContext object.

The following table summarizes all transitions between contexts that generate new page detection: