Embed Script
The fastest way to add the widget is a single script tag. Replace YOUR_CLIENT_ID and DOMAIN.
<$>
var ASTERLIO_API = ASTERLIO_API || {}, ASTERLIO_LoadStart = new Date();
(function(){
var s1=document.createElement('script'),s0=document.getElementsByTagName('script')[0];
s1.async=true;
s1.src='https://DOMAIN/api/asterlio-widget-loader/YOUR_CLIENT_ID';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
Manual initialization (optional)
If you prefer to load the script first and init later:
// after the script loads
window.ASTERLIO_API?.init('YOUR_CLIENT_ID')
Placement
- Place the script before the closing
</body> - Do not defer its loading; it is already
async
Security
- Add
https://DOMAINto your CSPscript-srcandframe-src - If you listen for events, validate
event.originequalshttps://DOMAIN