Skip to main content
For pages without a bundler, load the UMD build via a script tag. The bundle exposes a global Encore; the SDK instance lives on .default — unwrap it once.

Load the script

Self-host dist/umd/encore.min.js from the npm package with your own assets (see Install for the hosted-CDN note):
<script src="/vendor/encore.min.js"></script>

Configure, identify, show

<script>
  // The UMD global exposes the SDK instance on .default
  var EncoreSDK = Encore.default || Encore;

  EncoreSDK.configure({ apiKey: 'pk_live_yourpublishablekey' });

  // After login:
  EncoreSDK.identify('user-123'); // replaces the auto-generated anonymous UUID

  document.getElementById('cancel-btn').addEventListener('click', async function () {
    const result = await EncoreSDK.placement('cancel_flow').show(); // never rejects
    if (result.status !== 'claimed') {
      proceedWithCancellation(); // 'dismissed' or 'unavailable' — continue your flow
    }
  });
</script>
Full configuration options: configure().

Next steps