Integrate your affiliate program using the Partnero REST API for server-side tracking of sign-ups and sales.
This guide walks you through integrating an affiliate program using the Partnero REST API. Use this approach when you want server-side tracking with full control over the data you send.
Before proceeding, you should have a program created on Partnero. If you haven’t created one yet, refer to the Knowledge Base for guidance.
PartneroJS tracks referral visits by reading the partner key from the URL and storing it in a first-party cookie. This cookie is what your backend reads later during sign-up.
Paste the snippet into your website’s HTML just before the closing </head> tag:
Copy
<!-- 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, the script creates a partnero_partner cookie containing the partner’s unique key. This cookie persists for the duration configured in your program settings (default: 30 days).
When a new user signs up, your backend reads the partnero_partner cookie from the request and sends it to Partnero to attribute the customer to the referring partner.
Partner’s referral key from partnero_partner cookie
partner.email
string
Yes*
Partner’s email (alternative to key)
partner.id
string
Yes*
Partner’s ID (alternative to key)
key
string
Yes
Unique customer identifier (account ID or email recommended)
email
string
No
Customer’s email address
name
string
No
Customer’s first name
surname
string
No
Customer’s last name
tags
array
No
Tag names to assign to the customer
options.referral_url
string
No
The URL where the referral occurred
*Provide at least one of partner.key, partner.email, or partner.id.
Partnero ignores requests with an invalid partner key. You can send customer data for every sign-up without checking the cookie first—only customers with a valid referral will be recorded.
When a customer makes a purchase, record the transaction so Partnero can calculate the partner’s commission.
Prefer automatic tracking? If you use Stripe, Paddle, or Chargebee, transactions are tracked automatically through Partnero’s integrations—no API call needed. Set up integrations in Program settings → Integrations.
Partnero ignores transactions for customers that don’t exist in the system. You can safely send all purchase data without filtering by referred status.