Integrating Partnac Tracking into Your Website | Partnac Help

Integrating Partnac Tracking into Your Website

The foundation of any successful partner program on Partnac is accurate tracking. The Partnac tracking script (tracker.js) seamlessly attributes clicks to the right partners and tracks when those clicks result in a conversion, such as a signup, referral, or sale. Integrating Partnac into your website involves two main components: the global Click Tracking Code and the event-specific Conversion Tracking Code.

1. Locating Your Tracking Code

To get started, you need to grab the unique tracking scripts for your specific campaign:

Log in to your Partnac Business dashboard.
Navigate to your specific Campaign.
Open the Tracking Code Setup modal. Here, you'll find your customized snippets pre-filled with your Campaign ID.

2. Step 1: Installing the Click Tracking Code

The Click Tracking Code (often called the base script) is responsible for capturing partner referral links, storing the click session data in cookies, and tracking page views.

You must install this code on every page of your website. The best place to put it is within the <head> tags of your HTML, or just before the closing </body> tag.

  1. <!-- Click Tracking Code for Campaign: Your Campaign Name -->
  2. <script>
  3. window.partnac = window.partnac || function () {
  4. (window.partnac.q = window.partnac.q || []).push(arguments);
  5. };
  6. // The snippet below initializes the tracker with your specific Campaign ID
  7. window.partnac('init', { campaign: 'YOUR_CAMPAIGN_ID' });
  8. </script>
  9. <script src="https://scripts.partnac.com/tracker.js" type="text/javascript" async></script>
Note: Make sure to replace 'YOUR_CAMPAIGN_ID' with the actual ID from your dashboard.

3. Step 2: Setting up Conversion & Referral Tracking

Once the base script is tracking clicks, you need to tell Partnac when a user completes a desired action (like making a purchase or signing up). This is done using the window.partnac.conversion() function.

This code should only be fired on the success page or thank you page after the action has been completed.

Example A: Tracking E-commerce Sales

If you are tracking purchases, you'll pass details like the order ID and the total amount.

  1. // Call this after a successful checkout when Partnac is already loaded
  2. window.partnac.conversion({
  3.    unique_id: "order_12345", // Use your system's order ID, invoice ID or subscription ID. same id would be used during refund initiation
  4.    conversion_type: "sale",
  5.    amount: 99.99, // The total value of the sale
  6.    metadata: {
  7.       coupon_code: "SUMMER20",
  8.       timestamp: new Date().toISOString(),
  9.       currency: "USD",
  10.       customer_id: "cust_9876", // the same customer_id used for the referral tracking code
  11.       email: "customer@example.com",
  12.       name: "John Doe",
  13.    },
  14. });

Example B: Tracking Referrals / Signups

If your campaign goal is lead generation or signups, the tracking code looks slightly different. You usually pass an amount of 0 and use the user's ID as the unique_id to ensure idempotency (preventing duplicate tracking).

  1. // Send a referral tracking event upon successful user registration
  2. window.partnac.conversion({
  3.    unique_id: "user_56789", // Stable ID to prevent duplicate tracking
  4.    conversion_type: "referral",
  5.    amount: 0,
  6.    metadata: {
  7.       customer_id: "user_56789",
  8.       email: "newuser@example.com",
  9.       name: "Jane Smith",
  10.       country: "US"
  11.    },
  12. });

Understanding the Parameters:

  1. unique_id (Required): A unique identifier for the event (e.g., Order ID, User ID). Partnac uses this to ensure a single conversion isn't accidentally counted twice.
  2. conversion_type (Required): The type of event. Accepted values include sale, referral, lead, signup, download, install, subscription, or custom.
  3. amount (Required): The monetary value of the conversion. For free signups or leads, set this to 0.
  4. metadata (Optional): A flexible object to pass extra context. You can include coupon_code, currency, customer_id, email, and geographical data.

4. Step 3: Verifying Your Installation

After embedding the codes into your website, you need to ensure Partnac is receiving the signals correctly. Partnac includes a built-in verification tool inside the Tracking Code Setup modal:
  1. Click "Generate verify link". Partnac will create a special tracking URL (appending a ?ptc_verify=... parameter to your referral link).
  2. Open the verification link in a new tab. This forces the tracker.js script to execute and ping Partnac's servers.
  3. Return to the dashboard and click "Refresh status".
  4. If installed correctly, the status badge will turn green and say "Installed".
    • Related Articles

    • Setting Up Conversion Tracking (Pixels and Postbacks)

      While the standard Partnac JavaScript tracker (tracker.js) is the recommended method for most websites, some scenarios require a different approach. If you need to track backend subscription renewals, integrate with a CRM, or operate in environments ...
    • Understanding Partnac's Partnership Models

      Not all partnerships are created equal. On Partnac, you can run different types of campaigns depending on your goals, budget, and what you're trying to achieve. Understanding these models helps you choose the right approach and set up campaigns that ...
    • Welcome to Partnac: A Quick Start Guide for Brands

      Welcome to Partnac. You're here because you want to grow your brand through partnerships, whether that's affiliate marketing, influencer collaborations, or creator partnerships. This guide will get you up and running in the next 15 minutes. Partnac ...
    • Guide to Utilizing the Partnac REST API

      The Partnac REST API allows you to securely track clicks and conversions from your backend server, sync historical data, issue refunds, and update conversion states. Because it is server-to-server, it is completely immune to ad-blockers and browser ...
    • How Partner Payouts Work on Partnac

      Partnac ensures secure and transparent financial interactions between brands and partners using a built-in escrow system. When a brand initiates a campaign or accepts an application, funds are securely held to guarantee payment upon successful ...