> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fletch.co/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Fletch makes insurance products discoverable to and purchasable by AI agents, while the carrier keeps control of product rules, disclosures, consent, and payments. Fletch provides agentic commerce and agentic distribution for insurance, including APIs, an MCP server, a Web SDK, and journeys in assistants such as ChatGPT. Company overview: https://fletch.co/llms.txt. Agentic commerce: https://fletch.co/ai/. Contact: info@fletch.co.

# Integration Code

> Embed the pet insurance widget and pass customer data.

Follow these steps to integrate the Fletch Insurance Widget (FIW) into a website, web app, or mobile app.

Copy the code below into the page where the widget should appear. Height and width are fully customizable. Replace `#PARTNERCODE#` with the partner code. Contact [info@fletch.co](mailto:info@fletch.co) to get a partner code.

## Sandbox

```html theme={"dark"}
<iframe id="ifVCFrame" src="https://#PARTNERCODE#-wsb.fletch.co/" width="98%"
        height="850px" style="border: 0px !important;" loading="lazy"></iframe>
```

## Production

```html theme={"dark"}
<iframe id="ifVCFrame" src="https://#PARTNERCODE#-wp.fletch.co/" width="98%"
        height="850px" style="border: 0px !important;" loading="lazy"></iframe>
```

## Widget display types

Fletch offers a full widget and a mini widget. The full widget is optimized for 740px height. The mini widget is optimized for 400px height.

Append `?widget_type=Mini` to the source URL for the mini widget.

* Full: `https://#PARTNERCODE#-wsb.fletch.co/`
* Mini: `https://#PARTNERCODE#-wsb.fletch.co/?widget_type=Mini`

## Appending customer data

Partners can pass customer data to prefill the widget. Partners can pass attribution data for analytics. You can omit both data types.

Append query parameters as key-value pairs in the `?key=value` format. Separate each pair with `&`.

### Approach 1: Widget URL

Use this when the widget is a full-page redirect from the partner ecosystem.

`https://#PARTNERCODE#-wp.fletch.co/?zip_code=19121&pet_type=Dog&pet_breed=Golden%20Retriever`

| Key | Value |
| - | - |
| zip\_code | 5-digit valid US zip code |
| pet\_type | Cat, Dog |
| pet\_dob\_month | MM, 01 through 12 |
| pet\_dob\_year | YYYY |
| pet\_age | Age in months: 4, 9, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228. Use either pet\_age or pet\_dob\_month and pet\_dob\_year |
| pet\_name | Name of pet |
| pet\_breed | Breed name from the Fletch dropdown list |
| pet\_gender | Male, Female. Not applicable for the mini widget |
| owner\_fname | Customer first name |
| owner\_lname | Customer last name |
| owner\_phone | 10-digit phone number. Not applicable for the mini widget |
| owner\_email | Customer email |
| utm\_source | Source site generating the lead |
| utm\_medium | Medium, such as email or blog |
| utm\_campaign | Strategic or promotional campaign |
| utm\_term | Search term |
| utm\_content | Named asset that was clicked |
| affiliate\_id | Affiliate or partner promoting the campaign |
| insurer\_toprank | Insurer shown at the top of the quote engine. Values: pets\_best, figo, pumpkin, prudent\_pet, spot, lemonade, healthy\_paws, fetch\_pet\_insurance |
| solo\_insurer | Offer a single insurer. Same values as insurer\_toprank |
| quotes\_screen | For the mini widget, set to same\_window to show quotes in the same window |

### Approach 2: Client page URL

Use this when the partner redirects to a landing page that embeds the widget.

* Partner site: `https://#PARTNERWEBSITE#/fletch/?zip_code=19121&pet_type=Dog&pet_breed=Golden%20Retriever`
* Fletch landing page: `https://fletch.co/#PARTNERCODE/?zip_code=19121&pet_type=Dog&pet_breed=Golden%20Retriever`

The query parameters match Approach 1. `owner_number` is the phone field name in this approach.

Add this script after the iframe so the landing page forwards its query string:

```html theme={"dark"}
<script>
  var iframe = document.getElementById("ifVCFrame");
  if (typeof(iframe) !== 'undefined' && iframe !== null && window.location.search !== '') {
    var url = iframe.src;
    var separator = (url.indexOf('?') === -1) ? '?' : '&';
    iframe.src = url + separator + window.location.search.substring(1);
  }
</script>
```

### Approach 3: Partner application

Use this when the partner application and the Fletch widget are on the same page.

```html theme={"dark"}
<script>
  var iframe = document.getElementById("ifFLFrame");
  if (typeof(iframe) != 'undefined' && iframe != null) {
    var url = iframe.src;
    var separator = (url.indexOf('?') === -1) ? '?' : '&';
    iframe.src = url + separator + "key1=" + value1 + "&key2=" + value2 + "&key3=" + value3;
  }
</script>
```

### Approach 4: Popup on a call-to-action

Place the widget in a popup that opens when the user selects a button. Open [https://fletch.co/sritest/](https://fletch.co/sritest/). Select **View Rates**. Contact Fletch for the embedded script.

### Approach 5: Web integration package

1. Add the package in the page head:

```html theme={"dark"}
<script src="https://unpkg.com/@fletch-tech/widget@1.0.0/dist/main.min.js"></script>
```

Widget changes follow semantic versioning. Pin a version such as 1.0.0. Loading the latest version, or a range such as `@fletch-tech/widget@^1.0.0`, can pick up breaking changes.

2. Initialize the widget after the mount point. Use `<div id="fletch-iframe"></div>` for an embedded widget, or `<button id="fletch-iframe-trigger">` when `usePopup` is true.

```html theme={"dark"}
<script>
  fletchApp.init({
    src: "https://<partner-name>.fletch.co",
    usePopup: false,
    useMiniWidget: true,
    syncQueryParams: false,
    iframeProps: {
      height: "500px",
      width: "800px",
      style: { borderRadius: "25px" }
    },
    popupProps: {
      width: "800px",
      height: "500px"
    },
    queryParams: {
      zip_code: "60615",
      pet_type: "Dog",
      pet_name: "Max",
      pet_breed: "Afghan Hound",
      pet_gender: "Female",
      owner_fname: "Fletchtestone",
      owner_lname: "Fletchtesttwo",
      owner_phone: "9999999999",
      owner_email: "Fletchtestone+123@gmail1.com",
      pet_age: "24",
      utm_source: "blog",
      utm_medium: "organic",
      utm_campaign: "email",
      utm_content: "TEST",
      utm_term: "fullterm",
      affiliate_id: "partner-name",
      quotes_screen: "same_window"
    },
    mediaQueries: [
      { query: "(max-width: 768px)", style: { width: "500px", height: "700px" } },
      { query: "(max-width: 500px)", style: { width: "400px", height: "400px" } }
    ]
  });
</script>
```

| Parameter | Description |
| - | - |
| src | Partner-hosted widget URL |
| usePopup | Open the widget in a popup. Requires a button with id fletch-iframe-trigger |
| useMiniWidget | Use the mini widget |
| syncQueryParams | Copy query parameters from the partner page into the widget |
| iframeProps | Height, width, and style for the iframe |
| popupProps | Height, width, and style when usePopup is true |
| queryParams | Default values that pre-fill the widget. See Approach 1 for the full list |
| mediaQueries | Responsive styles. Each item has a query and a style object |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.