If you have a web application with multiple pages where each one triggers a new page refresh, then you will most likely need the basic JavaScript method. This means you will not need to create separate actions that activate when the Player appears or updates. The page refresh itself is enough to trigger the action. To set up the basic JavaScript, you only need to follow one step.
To implement the Player on your web app simply copy and paste the snippet below before the closing body tag on every page where you want the Player to work.
Include JavaScript library with the site API key
You can find your Site's API key including the snippet in the Portal at Site > Settings > Player installation.
<script>window.inlineManualOptions = { language: 'en'};</script>
<script>var inlinemanual_app_key="API_KEY";!function(e,n,a,t,i,r,s){e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},e[i].l=1*new Date,e[i].snippet={version:"2.0"},r=n.createElement(a),s=n.getElementsByTagName(a)[0],r.async=1,r.src=t,r.id=t+"-"+i,s.parentNode.insertBefore(r,s)}(window,document,"script","https://cdn.inlinemanual.com/inm/loader/loader." + inlinemanual_app_key + ".js","InlineManual");</script>
And then launch the Player with user data
<script> window.InlineManual("boot", { uid: "1", plan: "Gold" }, window.inlineManualOptions); </script>
State change - calling the update method - single page applications
When the application moves to a different page (or there is a state change) without page refresh where you want to re-check the metadata and automation, you will need to call the update method.
window.InlineManual("update");
Update profile
To update a user profile, add further parameters to the update call.
window.InlineManual("update", {uid:"1" ...});
Set language
To change the language on the fly, you can call update with language in it.
window.InlineManual("update", {language: 'en'});
window.InlineManual("update", 'en');
Shutdown
If the user logs out, you call shutdown. You can then boot the Player again with new user data when a different user logs in.
window.InlineManual("shutdown");
Angular
If you are getting any compilation errors you can add the following code for example in index.d.ts file:
declare global {
interface Window { InlineManual: any; }
}
You can add the inlineManualOptions too.