Standard Install

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>

Deploying with Next.js or React? See our Install with Next.js or React app instructions.

Add the Fairing code to your website

  1. Paste the above script just before the closing </body> tag on the page where you want Fairing to load.
  2. Replace API_KEY with your Fairing API Key. Your API Key can be found in Settings >> Publishable Key.
  3. Replace CUSTOMER_ID with whatever internal ID uniquely identifies a customer or account, e.g. email address.

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.

To use Fairing's new vs returning customer targeting logic, pass order_count in the opts.customer object.

Test

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

Additional configuration options (optional)

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


What’s Next

Review the more ways to customize the SDK.