ThriveCart

Integrating Kissmetrics with ThriveCart

Get ready to unlock powerful insights into your customer journey and sales performance by integrating Kissmetrics with ThriveCart. This guide walks you through everything you need to set up the tracking, ensuring you capture key events like purchases, affiliate attributions, and marketing campaign success.

What is ThriveCart?

ThriveCart is a high converting shopping cart platform designed to streamline online sales, manage upsells and downsells, and track affiliate performance. It is widely used by ecommerce businesses, digital product creators, and subscription based companies.

Why Integrate Kissmetrics with ThriveCart?

By connecting ThriveCart to Kissmetrics, you gain access to in-depth behavioral analytics, marketing attribution, and customer segmentation tool that help you optimize revenue and improve the user experience.

In this guide, we will walk you through how to connect your website and ThriveCart checkout with Kissmetrics. You’ll learn to:

  • Install the Kissmetrics JavaScript snippet across ThriveCart pages
  • Implement custom tracking for product purchases including bump offers, upsells, downsells
  • Understand the benefits of Kissmetrics analytics for ThriveCart users
  • Use Kissmetrics data to answer critical business questions.

Step 1: Installing Kissmetrics JavaScript snippet

To ensure Kissmetrics captures all traffic, marketing activity, site visits, page view, you should load our base JavaScript tracking snippet in the <head> section of all the pages of your website, including ThriveCart checkout pages. This also ensures user identity is maintained capturing full customer journey cross browser, cross device.

<script type="text/javascript">var _kmq = _kmq || [];
var _kmk = _kmk || 'YOUR_API_KEY';
function _kms(u){
  setTimeout(function(){
    var d = document, f = d.getElementsByTagName('script')[0],
    s = d.createElement('script');
    s.type = 'text/javascript'; s.async = true; s.src = u;
    f.parentNode.insertBefore(s, f);
  }, 1);
}
_kms('//i.kissmetrics.io/i.js');
_kms('//scripts.kissmetrics.io/' + _kmk + '.2.js');
</script>
  • Paste the JavaScript snippet into the <head> section of all website pages

Step 2: Implementing Custom Tracking for ThriveCart Purchases

With the Kissmetrics snippet in place on the website, we can now proceed to tracking purchase data, including transaction values, product details, affiliate information etc. giving you deeper insights into your ThriveCart sales.

How to Add Custom Event Tracking:

  • Log in to your ThriveCart account
  • Go to Products => Edit Product => Checkout => Tracking => Custom Scripts
thrivecart_tracking

📘

In Thrivecart, if you have multiple products adding custom code should be repeated.

  • Copy and paste the following script
<script type="text/javascript">
  var _kmq = _kmq || [];
  var _kmk = _kmk || 'YOUR_API_KEY'; // Make sure to put your API key from Kissmetrics Product Settings

  function loadScript(u) {
    setTimeout(() => {
      const s = document.createElement('script');
      s.type = 'text/javascript';
      s.async = true;
      s.src = u;
      document.getElementsByTagName('script')[0].parentNode.insertBefore(s, null);
    }, 1);
  }

  loadScript('//i.kissmetrics.io/i.js');
  loadScript('//scripts.kissmetrics.io/' + _kmk + '.2.js');

  function pushEvent(eventName, eventDetails) {
    _kmq.push(['record', eventName, eventDetails]);
  }

  function recordProductEvent(order, product, type) {
    const productEventDetails = {
      'Order ID': order.id || 'N/A',
      'Order Invoice id': order.invoice_id || 'N/A',
      'Affiliate ID': order.affiliate_id || 'no affiliate',
      'Account ID': _thrive.account.id,
      'Campaign ID': window._thrive_order.user?.campaign_id || 'no campaign id',
      'Product Name': product.name || 'N/A',
      'Product ID': product.id || 'N/A',
      'Product Quantity': product.quantity || 1,
      'Product Type': type,
      'Product Price': product.total_readable || 'N/A',
      'Purchase Frequency': product.purchase_type === 'single' ? 'one time purchase' : product.purchase_type || 'N/A',
    };

    pushEvent('Purchased product', productEventDetails);
  }

  window.addEventListener('load', function () {
    try {
      customer = _thrive.customer;
      if (customer && customer.email) {
        _kmq.push(['identify', customer.email]);
      }

      const orderIdInSession = sessionStorage.getItem('orderId');
      const orderConfirmedInSession = sessionStorage.getItem('orderConfirmed');
      const thriveOrder = window._thrive_order || {};
      const order = thriveOrder.order || null;

      if (order && order.id) {
        if (
          orderConfirmedInSession !== 'true' ||
          orderIdInSession !== order.id.toString()
        ) {
          pushEvent('Purchased', {
            'Order ID': order.id || 'N/A',
            'Order Invoice id': order.invoice_id || 'N/A',
            'Order Total': order.gross_readable || 'N/A',
            'Shipping cost': order.shipping || 'N/A',
            'Tax': order.tax_readable || 'N/A',
            'Affiliate ID': order.affiliate_id || 'no affiliate',
            'Coupon Code': order.coupon?.code || 'no coupon code',
            'Account ID': _thrive.account.id,
            'Campaign ID': thriveOrder.user?.campaign_id || 'no campaign id',
            'Customer Name': thriveOrder.customer?.name || 'N/A',
            'Currency': order.currency || 'N/A',
            'Discount amount': order.coupon?.discount || '0',
          });

          if (order.product) {
            recordProductEvent(order, order.product, 'Main Product');
          }

          if (order.bump) {
            recordProductEvent(order, order.bump, 'Add-on Product');
          }

          if (order.upsells) {
            Object.values(order.upsells).forEach(upsell => {
              recordProductEvent(order, upsell, 'Upsell Product');
            });
          }

          if (order.downsells) {
            Object.values(order.downsells).forEach(downsell => {
              recordProductEvent(order, downsell, 'Downsell Product');
            });
          }

          if (order.coupon) {
            _kmq.push(['record', 'Coupon Applied', {
              'Coupon Code': order.coupon.code || 'N/A',
              'Discount': order.coupon.discount || '0',
              'Order ID': order.id || 'N/A'
            }]);
          }

          sessionStorage.setItem('orderConfirmed', 'true');
          sessionStorage.setItem('orderId', order.id);
        }
      }
    } catch(e) {
      console.log('error in sending custom km events');
      console.log(e.message);
    }
  });
</script>
  • Save and test
  • Complete a test transaction to verify that events are recorded correctly in Kissmetrics
  • Use Live view and Network tab to see events flowing in real time
Developer Tools Network tab

Network tab

Live view

Live view

Benefits of using Kissmetrics with ThriveCart

BenefitDescription
Detailed Purchase InsightsTrack orders, products, and revenue with detailed events and properties
Affiliate AttributionAttribute sales to specific affiliates for better commission tracking
Campaign Performance AnalysisMeasure which campaigns drive conversions and revenue
User Behavior TrackingMonitor customer journeys and optimize various funnels
Custom Event FlexibilityDefine and track custom events tailored to your business needs
Accurate Revenue ReportingCapture precise revenue data with client or server side tracking options
Cross-Platform Data IntegrationCombine ThriveCart data with Kissmetrics’ reporting for a complete view

Example of 10 powerful business questions Kissmetrics can help answer for ThriveCart users

  1. Which campaigns drive the highest sales revenue?
  2. What is the average order value (AOV) across different traffic sources?
  3. How effective are upsells and downsells in increasing revenue?
  4. Which affiliates generate the most conversions?
  5. What percentage of customers use specific coupon codes?
  6. How does customer lifetime value (LTV) vary by traffic source?
  7. What are the most common user journeys leading to a purchase?
  8. Which products are purchased most frequently?
  9. How many customers abandon the cart during checkout?
  10. What impact do email marketing campaigns have on sales?

Next steps

Get started today and unlock the full power of Kissmetrics for your ThriveCart sales strategy!

Should you run into any questions about Kissmetrics plans, please contact [email protected]. For any help with integration, code tweaks, custom events, do not hesitate to shoot us a message at [email protected].