Skip to main content

Javascript (Browser) Integration Method

Track the conversion of a customer by triggering a conversion on your "Thank you" page

Written by Emmet Gibney
Updated this week

Integrating Rewardful is a quick way to set up affiliate and referral programs even if you're using a custom method for your checkout. We automatically track referred Visitors, Leads and Conversions from your affiliates, customers, influencers and/or partners. Commissions are automatically adjusted for any billing event changes such as downgrades, upgrades, free trials, cancellations and refunds.

Each person that signs up to your program will receive a personalized dashboard where they can create and manage their affiliate links, stats and track their success.

​To set up the integration:

  1. Paste the following JavaScript snippet into the global <head> tag of your website:

    <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://app.rewardful.dev/rw.js' data-rewardful='YOUR_API_KEY'></script>

    Replace 'YOUR_API_KEY' with your API key from this page.

  2. Add this script to your thank you page or order confirmation page or any page that the customer is redirected to after their Stripe customer record is created (usually after checkout):

    <script>
    rewardful('convert', { email: 'customer@example.com' });
    </script>

    You will have to replace 'customer@example.com' with a Javascript variable that contains the customer's email address.

  3. Go back to your Rewardful dashboard, click the Ok I've completed this button.

  4. On the next set of instructions, open the link that has a ?via=install on an incognito window or private browser, let your site fully load.

  5. Go back to your Rewardful dashboard and refresh the page. If the STEP 4 tracking script is correctly placed it will confirm your Rewardful initial dashboard setup.

  6. If there's no confirmation, please chat with us or email us so that we'll check things for you.

IMPORTANT NOTES:

  • Make sure you have added in your Rewardful API key in STEP 4.

  • Make sure you have replaced 'customer@example.com' in STEP 5 with the Javascript variable that holds the customer's email address. If you do not have this Javascript variable, check with your dev team if it's available in the frontend.

  • Make sure that the STEP 5 script is only loading in the page that's only displayed to the customer after they have completed the checkout.

    • If such page is pre-loaded/hidden, conversion tracking will not work.

  • The STEP 5 script will search for Stripe customer records that match the email address in the Javascript variable. The search scope are Stripe customer records that were created within the last 24 hours.

Did this answer your question?