Add the script
Get yourSCRIPT_URL and COMPANY_SLUG from the dashboard under Widget > Widget script, then add the script tag to your application.
data-key value identifies your widget configuration. Keep it aligned with the environment you are using.
Start and stop registration
After the script loads, usewindow.Satws.init() to open the registration experience.
window.Satws.destroy() to close and clean up the widget.
Sandbox warning
To show the legacy sandbox warning, passdata-sandbox="true" in the script tag.
The
data-sandbox attribute only controls the warning shown to users. The token and script URL determine whether the widget connects to production or sandbox.Events
Usewindow.Satws.subscribe to subscribe to widget events.
| Event | Description |
|---|---|
registerWithSuccess | Fired when registration succeeds. |
errorOnRegister | Fired when registration fails. |
Dynamic loading
If you load the widget dynamically in an SPA or through GTM, the script may not be ready when you callinit(). Listen for widgetScriptLoaded before starting registration.
Troubleshooting
- Confirm the script tag uses the
id="satws-widget-id"attribute. - Confirm
data-keymatches the widget configuration for the environment you are using. - Confirm the widget script is allowed by your Content Security Policy.
- Subscribe to
errorOnRegisterso your application can show a useful error state.