Here are the steps for integrating the Fletch Insurance Widget (FIW) into website / web app / mobile app.

Copy the below code in the appropriate location of your webpage / web app / mobile app to embed the Fletch Insurance Widget (FIW). Height and width iFrame parameters are fully customizable.

// Replace the #PARTNERCODE# in the below string with the partner code. To get a partner code, please contact Fletch ([email protected])

Sandbox

For Sandbox environment, the code snippet would be

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

Production

For Production environment, the code snippet would be

<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 two variations of our front end widget: full and mini widget. The full widget is optimized for 740px height while the mini widget is optimized for 400px height.

To configure the mini widget, append ?widget_type=Mini in the source URL.

Example full size widget source URL: https://#PARTNERCODE#-wsb.fletch.co/
Example mini widget source URL: https://#PARTNERCODE#-wsb.fletch.co/?widget_type=Mini

Appending Customer Data:

Partners have the ability to pass customer data and attribution tracking. This can be used to pre-fill the widget for a better customer experience that utilizes existing ecosystem data. It can also be used for analytics purposes via UTM parameters.

There are multiple ways to implement this; however, passing customer data is completely optional and does not affect widget functionality.

Query parameters is the set of key value pairs appended to the widget URL. The URL is appended with a ?key={value} and separated by & for multiple key value pairs.

Approach 1: Sending data from widget URL:

Use case: If widget is used in a full page redirect experience from the partner's ecosystem.

Fletch Hosted Widget URL:
https://#PARTNERCODE#-wp.fletch.co/?key1={value1}&key2={value2}&key3={value3}
https://#PARTNERCODE#-wp.fletch.co/?zip_code=19121&pet_type=Dog&pet_breed=Golden%20Retriever

Example Query Parameters:

KeyValue
zip_code5-digit valid US zip code
pet_typeCat, Dog
pet_dob_monthMM format. List of values from 01 to 12 representing January to December
pet_dob_yearYYYY format
pet_ageValue can be from 1 to 228 representing age in #months. Either pet_age or pet_dob_month & pet_dob_year can be used
pet_nameName of pet
pet_breedBreed name provided in dropdown list by Fletch
pet_gender (not applicable for mini widget)Male, Female
owner_fnameCustomer first name
owner_lnameCustomer last name
owner_phone (not applicable for mini widget)Customer phone number. Value should contain 10 digits
owner_emailCustomer email ID
utm_sourceSource site generating leading
utm_mediumMedium used (i.e. email, blog)
utm_campaignValue of strategic or promotional campaign
utm_termValue of the search term
utm_contentValue of named asset specifically clicked to bring the customer to the site
affiliate_idValue of affiliate or partner promoting the campaign
insurer_toprankInsurer quote that should be displayed top of the quote engine (valid values are pets_best or figo or pumpkin or prudent_pet or spot or lemonade or healthy_paws or fetch_pet_insurance)
solo_insurerPartner who wants to offer specific insurer policy can use this query parameter (valid values are pets_best or figo or pumpkin or prudent_pet or spot or lemonade or healthy_paws or fetch_pet_insurance)
quotes_screenWhen Partner embeds mini widget ie., widget_type=Mini, partner has ability to show quotes on same window using this key. The value of this quotes_screen key is same_window.

Approach 2: Sending data from client URL web page:

Use case: Redirect out to a separate landing page containing the embedded widget

Partner Hosted Website:
https://#PARTNERWEBSITE#/fletch/?key1={value1}&key2={value2}&key3={value3}
https://#PARTNERWEBSITE#/fletch/?zip_code=19121&pet_type=Dog&pet_breed=Golden%20Retriever

Fletch Hosted Partner Landing Page:
https://fletch.co/#PARTNERCODE/?key1={value1}&key2={value2}&key3={value3}
https://fletch.co/#PARTNERCODE/?zip_code=19121&pet_type=Dog&pet_breed=Golden%20Retriever

Example Query Parameters:

KeyValue
zip_code5-digit valid US zip code
pet_typeCat, Dog
pet_dob_monthMM format. List of values from 01 to 12 representing January to December
pet_dob_yearYYYY format
pet_ageValue can be from 1 to 228 representing age in #months. Either pet_age or pet_dob_month & pet_dob_year can be used
pet_nameName of pet
pet_breedBreed name provided in dropdown list by Fletch
pet_gender (not applicable for mini widget)Male, Female
owner_fnameCustomer first name
owner_lnameCustomer last name
owner_number (not applicable for mini widget)Customer phone number. Value should contain 10 digits
owner_emailCustomer email ID
utm_sourceSource site generating leading
utm_mediumMedium used (i.e. email, blog)
utm_campaignValue of strategic or promotional campaign
utm_termValue of the search term
utm_contentValue of named asset specifically clicked to bring the customer to the site
affiliate_idValue of affiliate or partner promoting the campaign
insurer_toprankInsurer quote that should be displayed top of the quote engine (valid values are pets_best or figo or pumpkin or prudent_pet or spot or lemonade or healthy_paws or fetch_pet_insurance)
solo_insurerPartner who wants to offer specific insurer policy can use this query parameter (valid values are pets_best or figo or pumpkin or prudent_pet or spot or lemonade or healthy_paws or fetch_pet_insurance)
quotes_screenWhen Partner embeds mini widget ie., widget_type=Mini, partner has ability to show quotes on same window using this key. The value of this quotes_screen key is same_window.

Please add the following script after the iFrame code:

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

Approach 3: Sending data from partner web application or mobile application:

Use case: Ecosystem partner application and Fletch widget reside on the same page

Please add the following script after the iFrame code

<script>
    var iframe = document.getElementById(‘ifFLFrame’)
    if(typeof(iframe) != 'undefined' && iframe != null ') {
        var url = iframe.src
        var separator = (url.indexOf('?') === -1) ? '?' : '&';
        var addQueryParam = url + separator + key1="+{value1}+"&key2="+{value of key2}+"&key3="+{value of key3}"  
        iframe.src= addQueryParam
    }
</script>

Example Query Parameters:

KeyValue
zip_code5-digit valid US zip code
pet_typeCat, Dog
pet_dob_monthMM format. List of values from 01 to 12 representing January to December
pet_dob_yearYYYY format
pet_ageValue can be from 1 to 228 representing age in #months. Either pet_age or pet_dob_month & pet_dob_year can be used
pet_nameName of pet
pet_breedGet breed name list by Fletch
pet_gender (not applicable for mini widget)Male, Female
owner_fnameCustomer first name
owner_lnameCustomer last name
owner_number (not applicable for mini widget)Customer phone number. Value should contain 10 digits
owner_emailCustomer email ID
utm_sourceSource site generating leading
utm_mediumMedium used (i.e. email, blog)
utm_campaignValue of strategic or promotional campaign
utm_termValue of the search term
utm_contentValue of named asset specifically clicked to bring the customer to the site
affiliate_idValue of affiliate or partner promoting the campaign
insurer_toprankInsurer quote that should be displayed top of the quote engine (valid values are pets_best or figo or pumpkin or prudent_pet or spot or lemonade or healthy_paws or fetch_pet_insurance)
solo_insurerPartner who wants to offer specific insurer policy can use this query parameter (valid values are pets_best or figo or pumpkin or prudent_pet or spot or lemonade or healthy_paws or fetch_pet_insurance)
quotes_screenWhen Partner embeds mini widget ie., widget_type=Mini, partner has ability to show quotes on same window using this key. The value of this quotes_screen key is same_window.

Approach 4: Opening widget in pop-up screen on click of CTA button:

Use case: Placing widget on pop-up screen when user clicks on CTA button

For reference, use the URL https://fletch.co/sritest/ and click on "View Rates" button to observe widget on pop-up screen. Kindly contact Fletch team for embedded script.

Approach 5: Incorporating the Fletch Widget with the web integration package

This approach showcases the integration of the Fletch widget into a partner-hosted web page through the use of the web integration package. This package simplifies the process of configuring and customizing the Fletch widget on a partner's website, providing a user-friendly experience.

Integration Steps

  1. Include Fletch javascript package:
    Include the Fletch JS package by adding the following script tag in the section:

<script src="https://unpkg.com/@fletch-tech/[email protected]/dist/main.min.js"></script>

Important note:Changes made to the Fletch widget are version-controlled (i.e. follows semantic versioning). If a partner uses a specific version (e.g., 1.0.0), any further changes will require updating to the latest version at their end.

Opting for the latest version without specifying a version number is possible, but it's not recommended due to potential breaking changes.

Semantic versioning ranges, such as @fletch-tech/widget^1.0.0, can be used to match any version within a specified range (e.g., 1.x) while avoiding versions outside that range.

Using a range version in the script src (e.g., https://unpkg.com/@fletch-tech/[[email protected]](mailto:[email protected])) will redirect to the latest version within the specified range (e.g., 1.0.0 at the moment). However, this approach is not recommended due to potential delays caused by redirects and caching considerations.

  1. Initialize Fletch Widget:
    Use the fletchApp.init() function to initialize the Fletch widget.
    Customize the parameters within the init function according to your requirements.
<script>
      // Fletch widget initialization 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: {
          // Specify default query parameters
          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: "[email protected]",
          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: [
          // Responsive styles for different screen sizes
          {
            query: "(max-width: 768px)",
            style: {
              width: "500px",
              height: "700px",
            },
          },
          {
            query: "(max-width: 500px)",
            style: {
              width: "400px",
              height: "400px",
            },
          },
        ],
      });
    </script>

Notes

  • Adjust the src property in the fletchApp.init() function to match your partner-hosted website URL.
  • fletchApp.init() function should be after the
    or click me
ParameterDescription
srcThe URL of the partner-hosted website where the Fletch widget will be embedded.
usePopupA boolean flag that determines whether to utilize a popup for the widget. When set to true, a popup will be employed; otherwise, the widget will be embedded as an iframe. To activate this feature, a button with the id "fletch-iframe-trigger" should be present.
useMiniWidgetA boolean indicating whether to use the mini-widget. If set to true, the mini-widget will be used
syncQueryParamsA boolean indicating whether to synchronize query parameters between the partner's website and the embedded widget. If set to true, query parameters from the partner's website will be mirrored in the widget.
iframePropsObject containing properties for the iframe, such as height, width, style
popupPropsObject containing properties for the popup when usePopup is set to true,
queryParamsDefault query parameters that pre-fill information in the widget. For the list of query-parameters, refer to approach 1 <#link> or 2 <#link> or 3 <#link>.
mediaQueriesAn array of objects defining responsive styles based on different screen sizes. Each object includes a query and style property. The query is a media query string, and style is an object containing CSS styles to apply when the query matches.

Let's expand on the iframeProps and popupProps:

PropertyDescription
heightThe height of the iframe or popup.
widthThe width of the iframe or popup.
styleAn object containing additional CSS styles for the iframe or popup.

Example iframeProps:

iframeProps: {
  height: "500px",
  width: "800px",
  style: {
    borderRadius: '25px',
  }
}

Example popupProps:

popupProps: {
  width: "800px",
  height: "500px",
  style: {
    borderRadius: '25px',
  }

}


                    Copyright Fletch Technologies, Inc. 2024