Ad Management SPA mode
In order to correctly manage ad calls between different pages of an SPA site, we provided two ways to detect a page change.
⚠️ This requires an activation from your Pubstack representative. Both for manual or auto mode.
auto
This mode look for URL’s changes, and modification in the <head> of the page. The check is simple and can cover simple cases, but is not enough to cover all publishers different setup.
manual
This mode give the publisher the freedom to fire the “page change” event when in need. In this way all needed modification (ex: page context, divs change) can be made on the page before our reload.
To send the event, please add this line in your script:
window.dispatchEvent(new CustomEvent('admSPAReload'));
Custom event
Other custom event - Can be activated ONLY by your Technical Account Manager :
waitForEventToConfigure
The
waitForEventToConfigure
option delays Pubstack’s execution until a specific event is triggered on the page.
This feature is useful for ensuring that any “early start” scripts are fully loaded before Pubstack begins its operations.
⚠️ Note for SPAs: In Single Page Applications, this feature must be used with care. The specified event must be triggered on every SPA navigation or reload to ensure proper functionality.
💡 Warning: Incorrect configuration may prevent monetization from initializing correctly.Setup Example:
"waitForEventToConfigure": "anEventName"
The value for this PocOverride
is a simple string. It must exactly match the name of the event that the page will emit once it’s ready for monetization