How to install Engagespot in a Single Page App

If your app is built as a Single Page Application, that is involving very few page refreshes or updating only a part of the DOM when a new page is loaded, you need to install Engagespot in a slightly different way.

Add the following Engagespot SDK to the <head> section of your SPA. Make sure that this code is placed only once inside your HTML code.

<script>window.Engagespot={},q=function(e){return function(){(window.engageq=window.engageq||[]).push({f:e,a:arguments})}},f=["captureEvent","subscribe","init","showPrompt","identifyUser","clearUser"];for(k in f)Engagespot[f[k]]=q(f[k]);var s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src="https://cdn.engagespot.co/EngagespotSDK.2.0.js";var x=document.getElementsByTagName("script")[0];x.parentNode.insertBefore(s,x); Engagespot.init('SITE_KEY');</script>


Did this help answer your question?

thumbs up
thumbs down

Thanks for the feedback! 🙏🏽


Help by drift