- Help Center
- HB Manager
- JavaScript API
relevantDigital.destroySlots()
Function to be used in Single Page Applications (SPA) when navigating between content
The destroySlots() function is designed to be used on SPA pages (React, etc) - in between page views. It will reset some internal state in the Relevant Yield script and reset ad slots in the ad server. The latter includes:
- For Google Ad Manager - googletag.destorySlots() will be called.
- For Xandr ad server - apntag.clearRequests() will be called.
Example
// No need to use relevantDigital.cmd.push()
// as we only need to call the function
// If the library is indeed initialized.
if(window.relevantDigital && relevantDigital.destorySlots) {
relevantDigital.destorySlots();
}