<aside> 💡 Unsure where to find the Userled Snippet? ‣
</aside>
A Multi-Page Application (MPA) is one which re-renders the entire site when moving between pages.
For an MPA, the snippet can be copied and used as-is. Each time a page is visited, the snippet will be re-run (it’s quick and light - there is no speed penalty) and Userled will be informed of each new page visit.
The snippet should be pasted right before the closing </body>
tag of your website.
Where you should embed the snippet depends on the framework you use. For example in a NextJS app, this would be in _document.tsx
.
<aside> <img src="/icons/code_blue.svg" alt="/icons/code_blue.svg" width="40px" /> The snippet looks something like this
<script id="userled-sdk-snippet">
window.userledSettings={app_id:"{{APP_ID}}"},window.userledSnippetTs=(new Date).getTime(),(function(){if(!window.Userled){window.Userled=function(){return e.call(arguments)};var e=window.Userled;e.call=function(n){return new Promise((function(i,d){e.queue.push([].concat.apply([i,d],n))}))},e.queue=[],e.snippetVersion="4.0.0",window.Userled("page")}})();
</script>
<script id="userled-sdk" type="module" src="<https://sdk.userledclient.io?appId={{APP_ID}>}&snippetVersion={{versionId}}" data-cfasync="false"></script>
</aside>
It must be added to every page which you intend to make visible to Userled. This is important! Speak to your teammate who is building experiences to understand which pages they are expecting to see events from and which pages they are expecting to build experiences on.
<aside> 👋 Struggling to integrate with your MPA framework? Get in touch - we’re here to help!
</aside>
Do you have a Single Page Application (SPA)? Checkout our SPA installation guide: