Integration Documentation

Pixel & Webhook Setup Guide

How Tracking Works

NOVA Affiliate Pro uses a two-step tracking system:

  1. 1.Click Tracking: When a user clicks an affiliate link, we record the click and store the affiliate code.
  2. 2.Conversion Tracking: When a sale is completed, we match it to the affiliate and calculate commissions.
Method 1: Pixel Tracking (Recommended)
Easy

Step 1: Install Tracking Pixel

Place this code in the <head> section of every page on your website. This tracks when visitors arrive via affiliate links.

Where to place it: In your website's main template/layout file (header.php, index.html, or theme header).

<!-- NOVA Affiliate Pro Tracking Pixel -->
<script>
(function() {
  // Extract affiliate code from URL (?ref=XXX)
  const urlParams = new URLSearchParams(window.location.search);
  const affCode = urlParams.get('ref');
  
  if (affCode) {
    // Store in localStorage for future conversions
    localStorage.setItem('nova_aff_ref', affCode);
    
    // Track click immediately
    fetch('https://novaaffiliatepro.com/api/trackClick', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        affiliate_code: affCode,
        offer_id: 'YOUR_OFFER_ID', // Get this from your merchant dashboard
        landing_page: window.location.href,
        referrer: document.referrer
      })
    });
  }
})();
</script>

Step 2: Track Conversions

Place this code on your thank-you / order confirmation page (the page shown AFTER a successful purchase):

Important: Replace YOUR_OFFER_ID with the actual offer ID from your dashboard. Replace order details with dynamic values from your checkout system.

<!-- Conversion Tracking - Place on Thank You / Success Page -->
<script>
(function() {
  const affCode = localStorage.getItem('nova_aff_ref');
  
  if (affCode) {
    // Send conversion event
    fetch('https://novaaffiliatepro.com/api/recordConversion', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        affiliate_code: affCode,
        offer_id: 'YOUR_OFFER_ID', // Get this from your merchant dashboard
        order_id: 'ORDER-12345', // Replace with actual order ID from your system
        sale_amount: 99.99, // Replace with actual sale amount
        customer_email: 'customer@example.com' // Optional: customer email
      })
    }).then(() => {
      // Clear affiliate cookie after conversion
      localStorage.removeItem('nova_aff_ref');
    });
  }
})();
</script>

📝 Setup Checklist:

  • • Get Offer ID: Go to Merchant Dashboard → Your Offers → Copy the offer ID
  • • API URL: Already configured to use https://novaaffiliatepro.com
  • • Test It: Visit your site with ?ref=TEST in URL, complete a purchase, check Admin Dashboard → Tracking
  • • Dynamic Values: Make sure order_id and sale_amount come from your checkout system (not hardcoded)
Method 2: Webhook Integration
Advanced

For server-side integration, you can send conversion data directly from your backend:

// Server-Side Integration Example (Node.js / Express)
// Use this when you want to track conversions from your backend

app.post('/order/complete', async (req, res) => {
  const { order_id, total_amount, customer_email } = req.body;
  
  // Get affiliate code from session/cookie (set when user clicked affiliate link)
  const affiliate_code = req.session.affiliate_ref;
  
  if (affiliate_code) {
    // Send conversion to NOVA Affiliate Pro
    await fetch('https://novaaffiliatepro.com/api/recordConversion', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        affiliate_code: affiliate_code,
        offer_id: 'YOUR_OFFER_ID', // From merchant dashboard
        order_id: order_id,
        sale_amount: total_amount,
        customer_email: customer_email
      })
    });
    
    // Clear affiliate reference after conversion
    delete req.session.affiliate_ref;
  }
  
  res.json({ success: true });
});

// Store affiliate code when user arrives via affiliate link
app.get('/product/:id', (req, res) => {
  const ref = req.query.ref;
  if (ref) {
    req.session.affiliate_ref = ref;
  }
  // ... render product page
});

🔐 Security Best Practices:

  • • Always validate webhook signatures to prevent fraud
  • • Use HTTPS for all API calls
  • • Store your API keys securely (environment variables)
  • • Implement rate limiting on your webhook endpoint
Method 3: Manual Entry
No Code

If you're not ready for automated tracking, you can manually record conversions:

  1. 1.Go to your Merchant Dashboard
  2. 2.Click "Record Sale Manually"
  3. 3.Enter the affiliate details, sale amount, and order ID
  4. 4.The system will automatically calculate commissions
Affiliate Link Format

Affiliates will share links in this format:

https://yourwebsite.com/product?ref=AFFILIATE_CODE

Where AFFILIATE_CODE is the unique code assigned to each affiliate.

Testing Your Integration

To verify everything works correctly:

  1. 1.Create a test affiliate account
  2. 2.Click your affiliate link with ?ref=TEST_CODE
  3. 3.Complete a test purchase
  4. 4.Check the Admin Dashboard → Tracking to see if the click was recorded
  5. 5.Check Admin Dashboard → Conversions to see if the sale was tracked

Need Help?

If you're having trouble with integration, we're here to help!