Skip to main content
This guide walks you through integrating Partnero tracking into your website using client-side JavaScript. Ideal for simple setups where you want to track sign-ups and sales directly from the browser.
Before proceeding, you should have a program created on Partnero. If you haven’t created one yet, refer to the Knowledge Base for guidance.

Step 1: Install PartneroJS

Install the PartneroJS snippet to track referral visits and attribute sign-ups to the correct partners.
1

Get your snippet

  1. Log in to Partnero
  2. Go to Programs and select your program
  3. Navigate to Integration in the sidebar
  4. Copy the PartneroJS snippet
2

Install the snippet

Paste the snippet into your website’s HTML just before the closing </head> tag:
<!-- PartneroJS -->
<script>
    (function(p,t,n,e,r,o){ p['__partnerObject']=r;function f(){
    var c={ a:arguments,q:[]};var r=this.push(c);return "number"!=typeof r?r:f.bind(c.q);}
    f.q=f.q||[];p[r]=p[r]||f.bind(f.q);p[r].q=p[r].q||f.q;o=t.createElement(n);
    var _=t.getElementsByTagName(n)[0];o.async=1;o.src=e+'?v'+(~~(new Date().getTime()/1e6));
    _.parentNode.insertBefore(o,_);})(window, document, 'script', 'https://app.partnero.com/js/universal.js', 'po');
    po('settings', 'assets_host', 'https://assets.partnero.com');
    po('program', 'PUBLIC_PROGRAM_ID', 'load');
</script>
<!-- End PartneroJS -->
When a visitor arrives via a referral URL (e.g., yoursite.com?via=PARTNER_KEY), the script creates a first-party cookie to store the referral:
  • partnero_partner for affiliate programs
  • partnero_referral for refer-a-friend programs
When the visitor signs up or makes a purchase, the cookie is used to attribute them to the correct partner.

Step 2: Sign-up Tracking

Notify Partnero when a new customer signs up to attribute them to the referring partner.

Universal Form Tracking (No-Code)

The simplest option - automatically captures sign-ups from standard HTML forms:
<script>
    po('integration', 'universal', null);
</script>
Add this at the bottom of pages with signup forms. It detects form submissions and creates customers using the submitted name and email.

JavaScript Sign-up Tracking

For more control, use the JavaScript method directly after a successful sign-up:
You don’t need to pass the partner key manually. PartneroJS automatically reads it from the partnero_partner cookie when present on the page.
po('customers', 'signup', {
    data: {
        key: 'customer_123456',  // Unique customer ID or email
        name: 'John',
        email: '[email protected]'
    }
});

Parameters

ParameterTypeRequiredDescription
keystringYesUnique customer identifier (account ID or email recommended)
namestringNoCustomer’s first name (max 100 characters)
surnamestringNoCustomer’s last name (max 100 characters)
emailstringNoCustomer’s email address (max 255 characters)
tagsarrayNoArray of tag names to assign to the customer
partner.keystringNoPartner’s referral key (auto-detected from partnero_partner cookie if not provided)

Complete Example

<html>
<head>
    <title>Sign Up</title>
    <!-- PartneroJS -->
    <script>
        (function(p,t,n,e,r,o){ p['__partnerObject']=r;function f(){
            var c={ a:arguments,q:[]};var r=this.push(c);return "number"!=typeof r?r:f.bind(c.q);}
            f.q=f.q||[];p[r]=p[r]||f.bind(f.q);p[r].q=p[r].q||f.q;o=t.createElement(n);
            var _=t.getElementsByTagName(n)[0];o.async=1;o.src=e+'?v'+(~~(new Date().getTime()/1e6));
            _.parentNode.insertBefore(o,_);})(window, document, 'script', 'https://app.partnero.com/js/universal.js', 'po');
        po('settings', 'assets_host', 'https://assets.partnero.com');
        po('program', 'YOUR_PROGRAM_ID', 'load');
    </script>
</head>
<body>

<form id="signup-form">
    <input type="text" name="name" placeholder="Your name" />
    <input type="email" name="email" placeholder="Your email" required />
    <input type="password" name="password" placeholder="Password" required />
    <button type="submit">Sign Up</button>
</form>

<script>
    document.getElementById('signup-form').addEventListener('submit', function(event) {
        event.preventDefault();
        
        const name = this.querySelector('input[name="name"]').value;
        const email = this.querySelector('input[name="email"]').value;
        
        if (email) {
            po('customers', 'signup', {
                data: {
                    key: email,
                    name: name,
                    email: email
                }
            });
        }
        
        // Continue with your form submission logic
    });
</script>

</body>
</html>

Step 3: Sales Tracking

Track purchases to reward partners according to your program’s commission structure.
Prefer automatic tracking? Connect your payment processor for automatic transaction tracking without writing code:
  • Stripe - Payments, subscriptions, and refunds
  • Paddle - Checkout and subscription events
  • Chargebee - Subscription billing
Set up integrations in Program Settings → Integrations.
JavaScript transaction tracking is disabled by default for security reasons. Enable it on your program’s Integration page, or use the API or payment gateway integrations instead.
PartneroJS automatically attributes transactions to the correct partner using the partnero_partner cookie—no need to pass the partner key manually.
Execute this script immediately after a successful sale:
po('transactions', 'create', {
    data: {
        key: 'transaction_123',
        amount: 99.99,
        amount_units: 'usd',
        customer: {
            key: 'customer_123456'
        }
    }
});

Parameters

ParameterTypeRequiredDescription
keystringNoUnique transaction ID (recommended for refund handling)
amountnumberYesTransaction amount
amount_unitsstringNoCurrency code (e.g., usd, eur, gbp)
product_idstringNoProduct ID for advanced commission rules
product_typestringNoProduct type/category for commission rules
customer.keystringYesCustomer identifier (from sign-up)
options.create_customerbooleanNoCreate customer if not exists and attach transaction

Next Steps