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 with a developer
Quick and simple implementation.
Install with Google Tag Manager
Implement through GTM - no coding required.
Test your implementation
Verify your implementation is working.
Additional Configuration
Optional fields that can be sent to enhance other features within Fairing.
Install Fairing on your site
Step 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>
Deploying with Next.js or React? See our Install with Next.js or React app instructions.
Step 2: Add the Fairing code to your website
a. Paste the above script just before the closing </body>
tag on the page where 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.
Step 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.
To use Fairing's new vs returning customer targeting logic, pass order_count
in the opts.customer object.
Step 4: Test
See Testing the Fairing Script for instructions on verifying your implementation.
Step 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.
Updated 10 days ago