Guide: Build an Affiliate Program From Scratch

Want to read my overview for this project? Read this other post.

There are several reasons you should consider building an affiliate program for your business. First, you can tap into new networks of customers you can’t reach through paid media. Second, it puts money in the hands of your customers. Third, it can be more cost-effective than paid media. And fourth, it is wise not to rely too heavily on any acquisition channel, as changes to search algorithms and ad pricing can disrupt your business if you rely on one of these channels for most of your customer acquisitions.

Affiliate programs are an ethical form of marketing because they don’t support the ecosystem of ad-driven surveillance technology. Rather, it relies on your customers and full-time affiliates becoming evangelists for your product.

Why build the program from scratch, when there are affiliate networks and software providers?

The primary advantage of building and running your affiliate program in-house is that you can save on fees that affiliate program software providers and affiliate networks charge, which is often around 30%. This means you can lower your acquisition cost and boost your numbers because you can pass on that value to your affiliates. Another advantage is that your sales cycle might be complex and require vetting each new lead. Having an approval process can reduce the likelihood that you are paying affiliates for low-quality leads, and is easier to manage in-house.

Getting Started

The tools you will use are Zapier and Google Sheets to start. For anti-fraud validation, you might want to add Phone Validator, IP2Location, and IP2Proxy. You should also create a landing page with a sign-up form, so affiliates can generate their code. If you use a database to validate that a lead has been qualified and have more qualified leads per week than you can reasonably sort through manually, you should create a dashboard to export your weekly qualified leads with the URL tag of the referrer you can paste into Google Sheets so that lookup functions can identify which referrers to issue payments to. In this episode, I’ll explain how to do almost everything from start to finish.

Part 1: Affiliate Sign-Up

First off, you’ll create your landing page where people can sign up to become an affiliate. This form should collect their full name, email, phone number, and residential address, including their country. There should also be a hidden field that collects their IP address. The form should use a calculation field to generate their referral code, I suggest using their first name (after removing any spaces) plus their form entry number after a dash. So, for example, if I were the first person submitting the form, my referral link would be Alec-1. You can create a separate page and form if you expect organizations or companies to refer people, so that the referral code has the name of the organization instead of the person filling out the form.

Upon successful submission, the form should output the referral link appended to a conversion page that includes detailed information on your company’s product. You should create a custom URL tag, like IRC, as an incoming referral code. Using this format, my referral code on my personal website would be

Next, I’ll describe how to build a Zap to validate the prospective affiliate’s submission and add them to your logs.

The first few steps of the Zap will validate the submission to confirm it is not fraudulent. At one of my previous companies, we only accepted leads from the United States, and made the decision to only admit referrers based in the United States as well to boost our brand credibility as referrers outside the US would not be able to credibly say they’ve used our product.

If you want to validate that the applicant is based near the address they gave you and isn’t using a VPN to mask their location, take the IP Address collected by the form in step 1 and look up the IP address using IP2Proxy. Do the same with the app IP2Location, which is made by the same company. You’ll need to pay for a package of credits before integrating with Zapier, but the credits are cheap.

In step 4, you’ll want to search their phone number in Phone Validator to confirm that it is a real US-based phone number. If you want to exclude submissions that use a VoIP number such as Google Voice, you can do so later.

Step 5 contains 3 paths. The first path is for applicants that pass the 3 checks they went through. In this path, we will now check that this sign-up isn’t a duplicate. We do this to reject applicants that might be attempting to avoid a ban from the affiliate program, or might have forgotten their original code.

Step 7 is a Google Sheets lookup that searches the sheet with your registered affiliates for the same IP address as a previous entry.

Steps 8 and 9 do the same with their email and phone number.

This path will now split into 3 additional paths. The first path is for applicants where no duplicate info was detected, the second is for duplicate IP addresses, and the third is for duplicate phone numbers. Applicants that go through the first subpath will be added to the sheet with affiliates with “Yes” in the “Approved?” column, and receive the standard welcome email that includes their link and resources on how to maximize qualified referrals. The second and third subpaths will add them to the sheet but with “No” followed by the reason for their disapproval in the “Approved?” column, and will receive an email explaining why they were rejected with instructions to respond if they believe this was in error.

Now we will return to step 5 where the first 3 paths originally split. The second path in my build was for people who signed up with an IP address in a different country. They would receive a rejection email explaining our referral program is US-only and would be added to the list of referrals with “No” and the reason for their rejection in the “Approved?” column.

The third path is for applicants that were using an IP Proxy or gave an invalid phone number. They would receive a rejection email with the option to respond if they want this original entry to be deleted so that they could resubmit the form. In some rare cases, there have been typos in phone numbers or users always had their VPN on but were still based in the US.

That's it for the Zap that validates Sign-Ups.

Part 2: Referral Validation

Now let’s pick things up with the second zap, which validates referrals. This is a long one – with all paths combined, there are 56 steps. I’ll do my best to describe the first 10.

Step 1 will pull data from your intake form, which should include a hidden field to collect IP addresses and a calculation field to pull the referral code from the URL variable, which is IRC in my example.

Step 2 can optionally filter for leads that are interested in your product and aren’t just inquiring.

Step 3 is a filter that checks if a referral code is present.

Step 4 was used to calculate the length of the lead’s submission. At a prior company that processed legal claims, we used this step to provide feedback to the person who made the referral if the lead we received was short so that they could encourage the people they refer to add more detail to their submissions. You can skip this step if this doesn’t apply to your business.

Step 5 is a Google Sheets lookup step that finds the row for the affiliate based on the referral code used, which will be used in anti-fraud checks and confirming that the affiliate is not banned.

Step 6 is a filter to check if the affiliate is banned. If the “Approved” column starts with No, the Zap will not continue.

Step 7 is a lookup step that checks if the email address was previously used to submit the intake form. The company I built this system for only paid affiliates for the lead’s first submission. This lookup step will use a different sheet with a list of submissions on the intake form that were made using a referral code.

Step 8 will look up the IP address using IP2Location's API.

Step 9 will look up the phone number using Phone Validator's API.

Step 10 is our first set of paths. Path 1 is for leads where no fraud is detected. Path 2 is for potential referral fraud. And path 3 is for leads that we deemed to be low quality or submitted by people outside of the country we accepted leads from.

That's all, for now...

If you'd like to learn how to set up these paths in your referral validation Zap, connect with me via email or LinkedIn and I'll give you a free consultation on how to set this up.

Blog posts


Lessons from Willy's Chocolate Catastrophe: Navigating AI's Role in Art and Labor

Alec Foster


Racing Towards AI Supremacy: Balancing Open Innovation with Ethical Responsibility

Alec Foster

Show more

Alec Foster

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 License.

Alec Foster

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 License.