Skip to main content
Hacktionbase.destroy()
Completely removes the Hacktionbase SDK from the page. This:
  • Stops session replay and flushes any remaining events
  • Stops automatic page view tracking
  • Stops error and console interceptors
  • Removes the chat bubble, iframe, and injected CSS from the DOM
  • Clears the widget JWT
After calling destroy(), you can call init() again to re-initialize with a new configuration.

Example: reinitialize with different config

Hacktionbase.destroy();

Hacktionbase.init({
  sdkKey: 'sk_live_new_key',
  tenant: 'different-tenant'
});

When to use

  • User logout — use Hacktionbase.logout() instead if you just want to clear identity without removing the widget
  • SPA route cleanup — if you only want the widget on certain pages, use hide()/show() instead
  • Full teardown — use destroy() when the SDK should be completely removed (e.g., switching tenants in a white-label app)