Add Rewardful to your website

The final step is to add Rewardful to your website so that we can track visits, leads, and conversions.
These instructions have been prepared for Sticky Speed.

Instructions for Stripe Checkout (client-side)

Choose a different setup method
These instructions are for the client-side version of Stripe Checkout, which runs entirely in the web browser with JavaScript.
Please see these instructions if you're using the server-side version of Stripe Checkout.
Overview
Rewardful integrates with Stripe Checkout by passing the unique click ID (i.e. referral ID) to Stripe as the clientReferenceId parameter when redirecting to checkout. It's important to note that Stripe Checkout will raise an error if clientReferenceId is set to a blank value. You may set this parameter to an arbitrary string if no referral is present. Our getClientReferenceId() function below will automatically do this for you.
Step 1: Install JavaScript Snippet
Paste the following JavaScript snippet into the <head> tag:
<script>(function(w,r){w._rwq=r;w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'rewardful');</script>
<script async src='https://r.wdfl.co/rw.js' data-rewardful='80669a'></script>
Copy
It must appear on every page of your application and marketing website.
Step 2: Pass referral ID to Stripe
When a visitor arrives on your website through an affiliate link, Rewardful creates a unique referral ID to represent that visitor. This value (a UUID string) must be passed to the stripe.redirectToCheckout() function call as the clientReferenceId parameter.
In the example below we add the clientReferenceId parameter to Rewardful.referral if it is set and call the stripe.redirectToCheckout() function.
var checkoutParams = {
  lineItems: [{ price: price, quantity: 1 }],
  mode: mode,
  successUrl: 'https://www.example.com/checkout?result=success',
  cancelUrl: 'https://www.example.com/checkout/?result=cancel'
}

if (window.Rewardful && window.Rewardful.referral) {
  checkoutParams.clientReferenceId = window.Rewardful.referral;
}

stripe.redirectToCheckout(checkoutParams);
Copy