How to integrate with ThriveCart

ThriveCart is an eCommerce software that helps you to promote and take payments for physical products, digital products, subscriptions and services to your customer. 

Integrating Prefinery with ThriveCart allows you to add purchasers into your referral campaign where they can also be rewarded for referring others. 

Installing Prefinery on ThriveCart

1

[Optional] If you want to set up a reward in Prefinery that requires a person to refer friends AND that those friends make a purchase, then create the reward in Prefinery and be sure to set the Award Event to Custom Event with the word "purchase" as the Award Event Name. 

Check out our help guide on triggering rewards with a custom event for more information on how this works.

2

From your Prefinery project dashboard, on the Installation page copy the Prefinery JavaScript snippet. 

3

In ThriveCart, navigate to Checkout then select the Tracking tab. 

Scroll down until you see the the Custom tracking code section then paste in the code snippet you copied earlier into the All pages: Paste tracking code to add to all this product's pages code box. 

4

You'll then use Prefinery's JavaScript Web API in order to add new ThriveCart customers as new users in your Prefinery campaign. Depending on your use case, you can use one of the following JavaScript code snippets: 

A. If you just want to add the customer to Prefinery after they make a purchase: 

<script>
  prefinery('addUser', _thrive_order.customer.email);
</script>

The above code will add new customers to Prefinery, and track all shares and referrals through their referral link. See example #1 of our JavaScript Web API tutorials for more details. 

If you need to also pass the user's name along with their email address to Prefinery, then as listed  in their documentation, ThriveCart can pass the customer's full name using the variable _thrive_order.customer.name. This means you could modify the above script into as follows: 

<script>
  prefinery('addUser', {
    email: _thrive_order.customer.email,
    full_name: _thrive_order.customer.name
  }
);
</script>

B. If you set up a reward in step 1, such that the customer's referral, after performing a custom action (e.g. "purchase"), also counts towards - and can trigger - a reward for their referrer, use this instead: 

<script>
  prefinery('addUser', _thrive_order.customer.email, function(user) {
    prefinery('triggerRewards', {
      email: user.email,
      event: 'purchase',
    });
  });
</script>

The above code will add new customers to Prefinery, record that they did the custom event "purchase", and track all shares and referrals through their referral link. See example #2 of our JavaScript Web API tutorials for more details. 

If you need to also pass the user's name along with their email address to Prefinery, then as listed in their documentation, ThriveCart can pass the customer's full name using the variable _thrive_order.customer.name. This means you could modify the above script into as follows: 

<script>
  prefinery('addUser', {
    email: _thrive_order.customer.email,
    full_name: _thrive_order.customer.name
  }, function(user) {
    prefinery('triggerRewards', {
      email: user.email,
      event: 'purchase',
    });
  });
</script>

Place one of the above code snippets, depending on your use case, into Thrivecart's Checkout > Tracking > Custom tracking code > Main product

Also, be sure to check "Only run this code the first time the customer gets to the success page".

5

Save your changes. 

If you're still having trouble finding where to place the scripts in ThriveCart, please refer to their documentation here: Adding scripts to your checkout pages.

What's next

If you've chosen to setup rewards, please refer to our guide here: How do I deliver rewards?

Still need help? How can we help? How can we help?