This guide explains how to integrate
Affonso’s affiliate marketing software with your Polar
account to track and manage affiliate-driven sales for your SaaS business.
Affonso is an affiliate marketing software that enables SaaS businesses to launch, manage, and scale their own affiliate programs. With Affonso, you can:
Set up flexible commission structures
Manage multiple affiliate programs from one dashboard
Provide your affiliates with real-time tracking and marketing resources
Automate affiliate payments and commission calculations
First, you’ll need to create an API token in Polar that Affonso can use to communicate with your account:
Login to your Polar Dashboard
Navigate to Settings in the main menu
Scroll down to the Developers section on the Settings page
Click the New token button
Give your token a name (e.g., “Affonso Integration”)
Set token expiration to No expiration
Important: If you set an expiration date, you’ll need to manually update the token in Affonso when it expires. Tracking will stop working if the token expires.
3. Add the Affonso Tracking Script to Your Website
Add Affonso’s tracking script to the <head> tag of your website:
Copy
Ask AI
<!-- Place in <head> tag --><script async defer src="https://affonso.io/js/pixel.min.js" data-affonso="YOUR_AFFONSO_PROGRAM_ID" data-cookie_duration="YOUR_COOKIE_DURATION"></script>
Replace YOUR_AFFONSO_PROGRAM_ID with the unique program ID provided by Affonso.This script should be placed on all pages of your website, including:
Your main marketing website
Your application domain
Any subdomains where users might land or make purchases
To ensure proper commission attribution, pass the referral data when creating checkout sessions:
Copy
Ask AI
// Get the referral ID from the Affonso global variableconst referralId = window.affonso_referral;// Create checkout session with Polarconst checkout = await polar.checkouts.create({ products: ["your_product_id"], success_url: "https://your-site.com/success", metadata: { affonso_referral: referralId, // Include referral ID from Affonso }});// Redirect to checkoutwindow.location.href = checkout.url;