ReferralHero
  • Welcome to the Support Center
  • Common Questions
  • Features
    • Subscribers
      • Subscriber Profile
      • Unique Identifier
      • Active Visitors
      • 'Quick Add' Referral
      • Update Referral Status
    • Campaign Templates
      • Contest
      • Website Referral Analysis
      • Net Promoter Score
    • Unique Identifier
      • Phone Number
      • Confirmation Email
        • Thank-You Page
    • Automations
      • A/B Test
    • Security
      • Manual Review & Confirmation
      • Secondary Verification Method
      • High Risk
      • Blacklist
      • ReCaptcha
    • Reward
      • Reward Status
      • Advanced Reward Options
      • Transactions
    • Analytics
      • Active Visitors
      • Subscribers
      • Sources
      • Shares
      • Devices
      • Unsubscribers
    • Misc
      • Memorable referral links
      • 1-Click Signup
      • Forward & Refer
      • Coupon Codes
      • Custom Attribution
  • Integrate
    • Embeddable Widgets
      • Custom Domain
    • Integrations
      • Active Campaign
      • Aweber
      • Blockchain
      • Facebook Pixel
      • Calendly
      • Discord
      • HubSpot
      • Intercom
      • KakaoTalk
      • Klaviyo
      • Mailchimp
      • Salesforce
      • SendLane
      • Slack
      • Stripe
      • Tango Card
      • Telegram
      • Tremendous
      • Twilio
      • Typeform
      • Webhooks
      • Zapier
      • Zoho
    • Platform-specific Instructions
      • Google Tag Manager
      • WordPress
      • Webflow
      • SquareSpace
      • ClickFunnels
      • Unbounce
      • Instapage
      • Shopify
      • Carrd
      • WIX
    • Javascript Web API
      • Getting Started
      • Configuration file
      • Callbacks
      • Add a subscriber
      • Add a Pending Referral
      • Track multi-step conversion events
      • Track Transaction
      • Identify a Subscriber
      • Identify a Referrer
      • Generate Dashboard Widget
      • Generate Sharing-Screen
    • ReactJS
    • REST API
      • Errors
      • Webhooks
      • Objects
      • Endpoint Reference
    • Mobile SDKs
      • iOS SDK
        • Getting Started
        • Public Methods
        • Public Classes
        • API Interaction Methods
      • Android SDK
        • Getting Started
        • Public Methods
        • Public Classes
        • Listeners & Interfaces
      • Flutter SDK
        • Getting Started
        • Public Methods
      • React Native
        • Getting Started
        • Public Methods
        • Mobile App Testing in Development Mode
      • Mobile App Testing in Development Mode
  • API Tutorials
Powered by GitBook
On this page
  • Why Track Ongoing Transactions?
  • How Does It Work?
  • Example: Tracking a Transaction

Was this helpful?

  1. Integrate
  2. Javascript Web API

Track Transaction

ReferralHero provides the ability to track ongoing transactions, allowing you to reward affiliates not just for the initial transaction but for subsequent transactions as well. This is particularly useful for businesses that want to offer commissions for recurring purchases, upgrades, or any other form of ongoing customer engagement.

Why Track Ongoing Transactions?

  • Maximize Affiliate Engagement: By rewarding affiliates for ongoing transactions, you incentivize them to drive not just sign-ups but also long-term, high-value customers.

  • Encourage Customer Retention: Affiliates are more likely to promote your brand if they know they can earn commissions on recurring purchases, leading to better customer retention.

How Does It Work?

To track ongoing transactions, you pass transaction data to ReferralHero using the method mentioned below. This method records details about each transaction, such as the transaction amount, product ID, and customer email. By doing so, ReferralHero can attribute these transactions to the appropriate affiliate and calculate commissions accordingly.

RH_MFxxxxxxxxxx.trackTransaction(data);

Example: Tracking a Transaction

This example dynamically collects transaction details from a form and then tracks the transaction when the form is submitted.

<script>
  window.RHConfig = {
    callbacks: {
      ready: function() {
        var form = document.getElementById('transaction-form');

        form.addEventListener('submit', function(e) {

          // Get the data from form inputs
          var data = {
            amount: form.querySelector('#amount').value,
            product_id: form.querySelector('#product_id').value,
            email: form.querySelector('#email').value,
            transaction_id: form.querySelector('#transaction_id').value,
            lifetime_spend: form.querySelector('#lifetime_spend').value
          };
          
          // Check if the ReferralHero instance is available and track the transaction
          if (RH_MFxxxxxxxxx) {
            RH_MFxxxxxxxxxxx.trackTransaction(data);
          }
        });
      }
    }
  };
</script>
<!-- HTML Form for Transaction Data -->
<form id="transaction-form">
  <input type="number" id="amount" placeholder="Transaction Amount" required />
  <input type="text" id="product_id" placeholder="Product ID" required />
  <input type="email" id="email" placeholder="Customer Email" required />
  <input type="text" id="transaction_id" placeholder="Transaction ID" required />
  <input type="number" id="lifetime_spend" placeholder="Lifetime Spend" required />
  <button type="submit">Track Transaction</button>
</form>

Replace the MFxxxxxxxxxx with your specific campaign UUID.

To verify that the transaction tracking is working correctly, you can follow these steps:

  1. Navigate to the Main Page: Start by logging into your ReferralHero account and navigating to the main dashboard.

  2. Access Reward Logs: Once on the main dashboard, go to the "Reward Logs" section in sidebar. This is where all tracked transactions and rewards are recorded.

  3. View Transactions: Within the "Reward Logs" section, find the "Transaction" sub-section. This will display all the transactions that have been tracked by ReferralHero.

  4. Check for Latest Transaction: Look through the list of transactions to find the most recent one. Verify that the details (e.g., amount, product ID, customer email) match the data you passed in your transaction tracking script.

If the latest transaction is listed with the correct details, it confirms that the transaction tracking is functioning as expected. If it's not there, double-check the implementation of your tracking script to ensure that all required data is being correctly captured and passed to ReferralHero.

PreviousTrack multi-step conversion eventsNextIdentify a Subscriber

Last updated 3 months ago

Was this helpful?

If Transaction is tracked successfully
If Transaction is not tracked