Single Page Architecture (SPA) compatibility guidelines
Unlike a static web page, a Single Page Application (SPA) is dynamic and only loads and executes the Digital embed.js
code when the SPA first loads. This means any JavaScript variable updates that happen as a result of interaction with the SPA are not sent with the feedback. To fully integrate a SPA with Digital, the website needs to notify that a route (page) change has occurred by calling the on-site SDK API. If this feature is not available on your property, contact your servicing team to get your account updated.
After the Digital on-site script is loaded on the website, a JavaScript object named KAMPYLE_ONSITE_SDK
exists, which provides several SDK APIs. Use the KAMPYLE_ONSITE_SDK.updatePageView()
function to force the Digital embed.js
code to execute. The SPA should notify Digital each time that a route (page) change has occurred.
<script type="text/javascript">
if (window.KAMPYLE_ONSITE_SDK && typeof window.KAMPYLE_ONSITE_SDK.updatePageView === 'function'){
window.KAMPYLE_ONSITE_SDK.updatePageView();
}
</script>
This code could be added using a tag manager to avoid making direct code changes.