← Writing

How hosting affiliate links earn commissions

When a reader signs up through an affiliate link and uses paid hosting, they pay the hosting provider. If the provider counts that usage as an eligible referral, it pays the writer a commission. A click alone earns no commission.

Suppose a reader finds a guide to deploying a Spring Boot app, signs up through its affiliate link, and pays for a server to run the app. DigitalOcean says it pays a 10% commission each month for one year based on the monthly spend of a new paying customer you refer. DigitalOcean Affiliate

If the eligible spend is $12 in a month, the commission for that month is $1.20. If the spending and eligibility stay the same for 12 months, the total is $14.40. The calculation below uses those assumed amounts.

Multiply $12 in eligible monthly spend by 10%, then add up $1.20 per month over 12 months to get $14.40.

Run the code below with Node.js to print the monthly commission and then the 12-month total. The expected outputs are 1.20 and 14.40, respectively.

const eligibleMonthlySpend = 12;
const commissionRate = 0.10;
const eligibleMonths = 12;
const monthlyCommission = eligibleMonthlySpend * commissionRate;

console.log(monthlyCommission.toFixed(2));
console.log((monthlyCommission * eligibleMonths).toFixed(2));

DigitalOcean Referral is a separate program that gives the referrer service credits when the conditions are met. DigitalOcean Referral

Discussion

View on GitHub ↗