Custom Snippet

Integrating Fairing onto any site or checkout. Version 1.0.0-beta.

Get Started

The Fairing script can be dropped onto a page to start collecting response data immediately. Your Fairing API Key and a unique customer identifier are the only required fields to get started.

The script includes a default styling. If you want to override any of the default styling, reach out to the Fairing team. See a preview of the out of the box style of the script here.

Install Fairing on your site

1. Copy the Fairing code

<script>
  (function() {
    const API_KEY = "PUT API KEY HERE";
    const CUSTOMER_ID = "PUT YOUR CUSTOMER EMAIL OR USER ID HERE";
    const s = document.createElement("script");
    
    s.src = "https://sdk.fairing.co/sdk/1.0.0-beta/fairing-1.0.0-beta.js";
    s.type = "module";
    s.defer = true;
    s.onload = function() {
      window.Fairing = Fairing(API_KEY, CUSTOMER_ID);
      Fairing.nextQuestion();
    };

    document.head.appendChild(s);
  })();
</script>

2. Add the Fairing code to your website

a. Paste the script below just before the closing </body> tag on the page you want Fairing to load.

b. Replace API_KEY with your Fairing API Key. Your API Key can be found in Settings >> Publishable Key.

c. Replace CUSTOMER_ID with whatever internal ID uniquely identifies a customer or account, e.g. email address.

3. Publish a question

Set a question or questions to Live. Questions will show to the customer sequentially based on the question targeting. Browse our Question Templates for inspiration.

🚧

All customers will see questions they haven't answered yet

By default, a question will display for all customers who haven't answered it yet. To target only specific customers – for example new customers – conditionally render the script tag above for only those customers.

4. Test

See Testing the Fairing Script for instructions on verifying your implementation.

5. Additional configuration options (optional)

Optional fields and configuration that can be sent in the script to enhance other features within Fairing. See options here.