Skip to content

Integration

ReachBell for HTML & JavaScript

A single <script> tag, a service worker file copied to your site root, and one ReachBell.init() call. No framework, no build step, no excuses.

@reachbell/sdk on npmbundle sizejsDelivr hits

Install

Two files: one script tag and one service worker copied to your site root.

<!-- Add before </body> on every page -->
<script src="https://cdn.reachbell.com/sdk/v1/reachbell.min.js" async></script>

<!-- And copy reachbell-sw.js to your site root.
     The Push API requires the service worker to be served from the same
     origin as the page — / not /assets/, not /static/. -->

Quick start

Initialize once, then call identify() and track() from anywhere on the page.

<script>
  window.ReachBellQueue = window.ReachBellQueue || [];
  window.ReachBell = window.ReachBell || {
    init:     (...a) => ReachBellQueue.push(['init',     a]),
    identify: (...a) => ReachBellQueue.push(['identify', a]),
    track:    (...a) => ReachBellQueue.push(['track',    a]),
    subscribe:(...a) => ReachBellQueue.push(['subscribe',a]),
  };

  ReachBell.init({
    projectId:   'prj_8h2k...your-id...',
    prompt:      { style: 'soft', delay: 8000, placement: 'bottom-right' },
    utm:         { source: 'site', medium: 'webpush' },
    serviceWorker: '/reachbell-sw.js',
  });

  // Identify the visitor once you know who they are
  ReachBell.identify({ email: 'jane@acme.com', plan: 'pro' });

  // Track a custom event — feeds segments and automations
  document.getElementById('cta').addEventListener('click', () => {
    ReachBell.track('clicked_hero_cta', { variant: 'B' });
  });
</script>

What you get

Push, in-app widgets, segments, A/B tests, automations, and analytics — from a single 10 KB script.

Zero build step

Works on any static site — Hugo, Jekyll, 11ty, Astro, plain HTML. Drop a script tag, copy the service worker file, you are done.

Async, deferred, queued

The init snippet uses an async loader and a call queue, so anything you call before the SDK finishes loading runs in order once it does. Won&apos;t block first paint.

Prompt designer, no redeploy

Prompt copy, colors, position, and timing are pulled from the dashboard at runtime — change the wording without touching your HTML or shipping a new build.

Widgets bundled in

The toast widget (v1.0.3), banner + notification center (v1.0.4) ship inside reachbell.min.js — render them with one ReachBell.show() call, no extra files.

attachUtmTagger()

Call ReachBell.attachUtmTagger() (v1.0.5) once and outbound clicks pick up UTM params automatically — campaign attribution lines up in GA4 with no manual work.

Sub-10 KB

Single bundle is 9.8 KB gzipped including the prompt, the widgets, and the identify/track API. CDN-cached for one year with stale-while-revalidate.

Looking for the full SDK reference?

Every method, callback, and widget option is documented with copy-paste snippets at docs.reachbell.com/integrations/html-javascript.

FAQ

Questions, answered.

Everything teams usually ask before switching. Something missing? Email us — a human replies.

Do I have to copy reachbell-sw.js to my site root?

Yes. The Push API only registers service workers from the same origin and scope as the page — placing the file under /assets/ or /static/ silently breaks subscription. Two-line copy step in your build is usually enough.

Can I self-host the SDK instead of using the CDN?

Yes. The bundle is published on npm as @reachbell/sdk and on jsDelivr too. Use your own CDN if you have a content security policy that disallows third-party origins.

Does it work on Astro, Hugo, Jekyll, 11ty?

Yes. The script tag is framework-agnostic — anywhere you can render plain HTML, the SDK works. Astro users typically import it from a global layout file.

What about CSP (Content Security Policy)?

Add cdn.reachbell.com to script-src, https://api.reachbell.com to connect-src, and https://*.reachbell.com to img-src. The docs page has the exact directives.

Three lines and you're live.

Free for your first 1,000 subscribers. No credit card.

Ready to make some noise?

Free forever for your first 1,000 subscribers. Set up in five minutes — no credit card needed.

Start free today