Developer docs

Widget reference

The complete install, configuration attributes, submit payload shape, and answers to the questions everyone asks. Two lines of code and you are shipping.

Install

Paste the following two lines wherever you want the quote form to appear on your site. The target div marks the mount point; the script renders the form inside it. Nothing else needs to be configured, imported, or built.

<div id="insureloop-widget"></div>
<script src="https://app.insureloop.io/embed/widget.js" data-agency="your-agency-slug"></script>

Replace your-agency-slug with your actual slug (see it in the InsureLoop app at /app/widget).

Where to paste it

  • WordPress: add a Custom HTML block to any page or post, or paste into your theme footer for a site-wide widget.
  • Wix: add an Embed Code / HTML iframe element and paste the snippet.
  • Squarespace: add a Code Block to any page section.
  • Webflow: drop in an Embed component and paste the snippet.
  • Hand-rolled HTML: paste directly into your template. The script tag can live in <head> or before </body>.

Configuration attributes

All configuration lives on the script tag itself as data-* attributes. There is no JavaScript configuration object, no init call, no global. The widget reads the tag once on load.

data-agency Required string

Your agency slug. Every submission is tagged to this tenant. Find yours in the InsureLoop app at /app/widget.

data-agency="acme-insurance"
data-color Optional CSS color default: #2563eb

Accent colour for the submit button. Accepts any valid CSS colour value.

data-color="#0ea5e9"
data-title Optional string default: Get a free quote

The heading text at the top of the form.

data-title="Save on auto insurance"
data-subtitle Optional string default: Takes 60 seconds. No spam, no pressure.

Sub-heading under the title. Short and plain works best.

data-subtitle="Free quote in under a minute"

Styling

The widget renders with inline CSS only. That guarantees it looks the same on every host page regardless of that page's global styles. For the common cases (accent colour, heading, subheading) use the data-* attributes above.

For heavier styling, wrap the target div in a container of your own and constrain it. The widget respects the width of its parent up to 520 pixels.

Constrain to a column

<div style="max-width: 400px; margin: 0 auto;">
  <div id="insureloop-widget"></div>
</div>
<script src="https://app.insureloop.io/embed/widget.js" data-agency="your-agency-slug"></script>

Branded colour

<div id="insureloop-widget"></div>
<script
  src="https://app.insureloop.io/embed/widget.js"
  data-agency="your-agency-slug"
  data-color="#0ea5e9"
  data-title="Save on your auto insurance"
  data-subtitle="Free quote in under a minute"></script>

Submit payload

When a visitor submits the form the widget POSTs JSON to https://app.insureloop.io/api/il/embed/submit. You do not need to call this endpoint yourself. It is documented here so you can build against it or debug integrations.

Request body

{
  "agency_slug": "acme-insurance",
  "first_name": "Sarah",
  "last_name": "Kim",
  "email": "sarah.kim@example.com",
  "phone": "555-201-4497",
  "zip": "34103",
  "product": "auto",
  "tcpa_consent": true,
  "page_url": "https://acme-insurance.com/auto",
  "page_referrer": "https://google.com/"
}

Required fields: agency_slug, first_name or full_name, email or phone, tcpa_consent (must be true).

Response

{
  "ok": true,
  "message": "Thanks! We'll be in touch shortly.",
  "contact_id": "5c1a83d1-6e9f-4d02-8e7b-8ffa9e2c1f42",
  "lead_id": "b47a9d3f-40a1-4cf4-93a8-1a7d3f8a2d18"
}

On validation failure the response is { ok: false, error: "..." } with a 4xx status. The widget surfaces the error text inline. On unknown slug the response is 404.

FAQ

How do I preview it before I paste it on my site?

The InsureLoop app has a live preview inside /app/widget that renders the exact widget your visitors will see, running against your agency slug. Submissions from that preview land in your pipeline as real leads, so use test data.

Does it work on mobile?

Yes. The widget is fully responsive, uses the system font stack, and renders correctly on iOS Safari, Chrome for Android, and every desktop browser. It has no external CSS or JS dependencies, so it never breaks because a CDN went down.

Can I customize the colours?

Yes. Pass a data-color attribute on the script tag for the submit button accent. For deeper customization (backgrounds, borders, spacing) the widget is a single self-contained element with inline styles; the roadmap includes a full data-theme attribute for JSON-based theming.

Can I use it on multiple pages or multiple sites?

Yes. Paste the same snippet on as many pages or sites as you like. Every submission is tagged with the referring page URL and referrer header so you can see which page is converting best. Multiple sites can share the same slug, or you can spin up per-site slugs if you want distinct reporting.

What happens if my visitor is on a slow connection?

The widget script is roughly 8 kilobytes gzipped and served with a 5-minute cache header. It renders as soon as it downloads, even before the target div paints. There is no hydration step and no framework, so first paint and interaction are effectively the same moment.

What data is stored on every submission?

Full name, email, phone, ZIP, product, page URL, referrer, TCPA consent flag and timestamp. All of it lands on the contact record in your InsureLoop book with source=widget and vendor={your-slug}-website. Nothing is sent to a third party.

Is the endpoint rate-limited?

The submit endpoint applies per-IP rate limits at the platform edge. Individual agencies do not need to configure anything. If you expect a burst (a paid campaign, a viral post) let us know and we can raise the ceiling.

Can I add hidden fields for UTM tracking?

Not on the current release. UTM parameters are captured via document.referrer and window.location.href server-side; explicit UTM field capture and a data-fields attribute for extra questions land in the next revision.

Something not covered here?

Email <a href="mailto:support@insureloop.io" class="underline">support@insureloop.io</a> and a real engineer will answer.