> For the complete documentation index, see [llms.txt](https://authentic.gitbook.io/authentic-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://authentic.gitbook.io/authentic-docs/embedding-insurance/add-insurance-to-your-platform/embed-our-widget.md).

# Embed our widget

**Installation**

Add the following script tag to the `<head>` of your `index.html` file.

```html
<script type='module' src='https://www.unpkg.com/@authenticins/widget@latest/dist/authenticWidget.js'></script>
```

To view the source code go here: <https://www.npmjs.com/package/@authenticins/widget?activeTab=readme>

**Usage**

Once installed, the widget script will expose controls to the browser window. You can configure the widget's look and behavior on initialization (see the full `WidgetConfig` definition below).

```html
<script>
  window.addEventListener('load', () => {
    window.authenticWidget.init({
      portal: { url: 'https://example-tenant-name.prod.authenticinsurance.com' },
      prefillData: {
        lead: { email: 'johndoe@email.com' }
      },
      themeOverrides: {
        primaryColor: '#000000',
        borderRadiusPx: 6,
        brand: {
          name: 'Example Tenant Name',
          logoUrls: {
            darkBg: 'https://example-tenant-website.com/logo-white.png',
            lightBg: 'https://example-tenant-website.com/logo-black.png'
          },
          faviconUrl: 'https://example-tenant-website.com/favicon.ico'
        }
      }
    });
  })
</script>
```

**Note**: We recommend adding UTM parameters to the widget (more information on UTMs can be found [here](/authentic-docs/embedding-insurance/tracking-marketing-utm-params.md)). Partners can do this by adding the UTM parameters as normal onto the insurancePortal url in the widget script. An example would be:

```javascript
portal: { url: 'https://example-tenant-name.prod.authenticinsurance.com&utm_source=tenant-name&utm_medium=widget' },
```

**Configuration**

```ts
interface WidgetConfig {
  portal?: {
    url?: string;
    // The CSS selector for the target element you want the Portal injected into.
    // If no target selector is provided, the widget will inject its default persistent banner and modal.
    targetSelector?: string;
  };
  customerId?: string;
  prefillData?: {
    lead?: {
      email:? string;
      businessClassCode?: string;
      stateCodes?: string[];
      productIds?: string[];
    };
    responses?: {
      exposures?: Array<{
        exposureName: string;
        // Where each key is a field's name mapped to its value (e.g. ['BUSINESS_LEGAL_NAME']: 'Example Business Name');
        fieldValues: Record<string, string>;
      }>;
      // Same as format described above.
      questions?: Record<string, string>;
    };
  };
  themeOverrides?: {
    useDarkMode?: boolean;
    primaryColor?: string;
    secondaryColor?: string;
    borderRadiusPx?: number;
    brand?: {
      name?: string;
      logoUrls?: {
        darkBg?: string;
        lightBg?: string;
      };
      faviconUrl?: string;
    };
  };
};
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://authentic.gitbook.io/authentic-docs/embedding-insurance/add-insurance-to-your-platform/embed-our-widget.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
