3 horizontal lines, burger
3 horizontal lines, burger
3 horizontal lines, burger
3 horizontal lines, burger

3 horizontal lines, burger
Remove all
LOADING ...

Content



    How to connect and use affiliate programs on your website: my case study

    Clock
    22.09.2025
    /
    Clock
    11.03.2026
    /
    Clock
    8 minutes
    An eye
    373
    Hearts
    0
    Connected dots
    0
    Connected dots
    0
    Connected dots
    0

    Introduction

    Hi, this article is dedicated to my personal experience with affiliate programs. Specifically, I'll cover how to add affiliate links to a website, how to choose them, where to insert them, and whether it's possible to calculate their profitability using a specific example, like my website.
    The article isn't finished yet; I'm waiting for statistics and results for the final chapter. But for now, you can familiarize yourself with what kind of affiliate programs to use and how to apply them on a website like mine.
    Consider this article as a tutorial with a specific case study.
    1. First, we'll look at what an affiliate program is and which ones I'll be using.
    2. Then, I'll show you my website stats so you understand the framework I used to place my affiliate programs.
    3. Next, I'd like to share my approach to how to integrate affiliate links into the website.
    4. And finally, I'll summarize how much I earned, where I earned it, and what's next.

    About affiliate programs

    What is an affiliate program, and why use it? The idea is to attract customers with minimal business costs. The advertiser (the creator of the affiliate program) receives a customer, and the affiliate receives a portion of the profit from the customer's spending on the promoted product.
    The advertiser loses nothing; they only gain and pay a portion of the profit to the affiliate participating in the program.
    An affiliate program is a strategy for attracting customers to their products and services through a third party that offers them(the products) to their own audience.
    The size and percentage of profit depend on the advertiser's model. Here are the main payment models:
    1. CPM (Cost Per Mile) - Cost per 1,000 views, like YouTube
    2. CPC (Cost Per Click) - Cost per click
    3. CPA (Cost Per Action) - Cost per user action after a click. This could be a registration, purchase, or subscription.
    4. CPL (Cost Per Lead) - Cost per lead
    5. CPI (Cost Per Install) - Cost per install
    The most popular, at least in the CIS, is CPA. It pays the most because the money is already in circulation, so to speak. The least popular (or rather, the least paid) among advertisers is CPM, because a view doesn't guarantee a purchase. It guarantees nothing.
    Work of Affiliate Programs.

    Which affiliate programs will I use?

    It's important to choose affiliate programs you understand and whose products you personally use. Just like "Breaking Bad":
    Like in "Breaking Bad", but in reverse. Always use what you sell. :) In the context of digital products, of course.
    Otherwise, you won't be trusted, and how can you be a partner and offer products you don't use yourself? It's a rhetorical question. Absolutely not.
    But for the next two to three months, I'll be offering an affiliate program I know nothing about—SendPulse. You'll see, people sense that, and I won't get anything from SendPulse.
    And here are my main affiliate programs, which I've tried, which I know, and which I'll also offer:
    1. Beget - hosting provider and domain registrar
    2. Reg - hosting provider and domain registrar
    3. Timeweb - hosting provider and domain registrar
    Honestly, I like all three hosting providers. Each has its own nuances, but overall, they're similar. At least when it comes to deploying websites on a VPS.

    Why these affilate programs, or how to choose your own?

    Well, let me start by saying that an affiliate program should promote a product or service that you use and would recommend to your friends. Secondly, it should be relevant to what you're already doing on your website.
    To be honest, I tried to find affiliate programs using AI (Perplexity, DeepSeek, and Copilot), but... it didn't work out very well. Of course, they gave me general recommendations (within the bounds of common sense), nothing more. I also tried to find an affiliate program for articles about QuillJS, but without success. There's nothing suitable or relevant.
    Of course, I considered using affiliate programs from GeekBrains, Udemy, and SkillBox. But that's against what I'm doing here. Namely, self-study, where, oddly enough, you have to discipline yourself and learn independently. That's it.
    Here's how to choose your affiliate program:
    1. Determine the location and content (article) where you'd like to insert the affiliate link.
    2. Determine the type and niche of affiliate programs that match the intent and target audience of the material. For example, an article about deploying a website on Timeweb hosting. An affiliate program from Timeweb or similar hosting providers would be ideal. Thought for english speaker it's not ideal, I admit it.
    3. Find the necessary affiliate programs. Search engines are ideal for this. They also make it easy to filter by country or language. You can also use specialized aggregator sites for affiliate marketers, such as partnerkin.com or admitad.ru.
    4. Be sure to test it and decide whether it's worth recommending. Ideally, you should already be using it and have some opinion on the matter.
    5. Insert links in the appropriate places.
    Some advertisers allow you to specify an entire website as a traffic source, without having to insert any links at all. For example, all three hosting providers (Beget, Reg, and Timeweb) allow this. This method has only two significant drawbacks: it is not available to everyone, and it is impossible to track who came from where, so you can understand what works and what doesn’t.

    Now about my website's stats

    So, how should I describe my website? It's a blog with a collection of self-developed tools. The topics are applied development, automation, and the creation of useful open-source utilities. I would guess that my target audience consists of:
    1. Self-taught and independent developers
    2. Technical website creators
    3. Python/Django developers
    Well, as they say, man proposes, and God disposes. Maybe my site also includes people from other fields, like SEO or marketing, who knows. Analytics won't reveal that. Here are my site's traffic statistics for the last 30 days (August 19, 2025 - September 18, 2025):
    Or in PDF format
    I can't say whether this is a lot or a little – I don't know. Everything is relative. Of course, everything could change over the next two months, and if so, I'll mention it here. For now, I need to tell you how I implemented it on the site.

    Integrating affiliate programs into the site

    My favorite, technical part. You can skip it if you use builders, a CMS, or anything other than Django and Python. So, the main question: Why not just insert links where needed? Of course, you can do that, but I'd like to control what I recommend and how I do it.
    So, I've divided my site into three sections where I can recommend affiliate programs:
    1. Homepage – This is where I can recommend the most affiliate programs, and the best ones at that.
    1. Pagination Pages - I also wanted to leave recommendations here when selecting certain filters. Don't rely too much on this section.
    1. Articles and Tools - I created a "What I'm using" section at the very beginning. Plus, you can seamlessly incorporate your referral links into the article/tool ​​content.
    I also created the corresponding models to store Referral Links.
    This app, Affiliate, is designed to support multilingual websites like mine. Therefore, an English-speaking visitor will never see an affiliate program designed for Russian speakers.
    All of this was implemented as a separate Django application, Affiliate, which functions as a middleware layer that returns all available affiliate links and renders them in a template. Here's the code for the middleware layer itself:
    from django.db.models import Q from django.template import loader from django.template.response import TemplateResponse from Main.utils import getAllWithTags from Post.models import Tag, Post from .models import AffiliateLink, AffiliateLinkConnectionTag, AffiliateLinkConnectionSlug, AffiliateLinkConnectionSpecial class AffiliateMiddleware: def __init__(self, get_response): self.get_response = get_response self.handler = None self.home_view = ('home',) self.post_view = ('article', 'tool', 'tool_main') self.pagiscroll_view = ('PagiScroll/base_post_list.html',) def __call__(self, request): response = self.get_response(request) return response def process_view(self, request, view_func, view_args, view_kwargs): self.handler = None if view_func.__name__ in self.home_view: self.handler = self.home_handler elif view_func.__name__ in self.post_view: self.handler = self.post_handler return None def process_exception(self, request, exception): pass def process_template_response(self, request, response: TemplateResponse): if response.context_data: response.context_data.update({'isAffiliateLinkMiddlewareConnected': True}) if self.handler is not None: self.handler(request, response) elif response.template_name in self.pagiscroll_view: self.pagiscroll_handler(request, response) self.handler = None return response def home_handler(self, request, response): if response.context_data: affiliates = [] affiliates_context = AffiliateLinkConnectionSpecial.objects.filter(special=AffiliateLinkConnectionSpecial.SpecialPages.HOME) if len(affiliates_context) > 0: aff_ids = [] for aff_id in affiliates_context.values_list('affiliate'): aff_ids.append(aff_id[0]) affiliates = AffiliateLink.objects.filter_by_lang().filter(id__in=aff_ids) response.context_data.update({'affiliates_partners': affiliates[:3]}) def post_handler(self, request, response): if response.context_data: affiliates = [] # Делим строку urlList = request.path.split('/') # Чистим не нужный мусор c = urlList.count('') for i in range(c): urlList.remove('') # Проверяем есть ли такой инструмент slug = urlList[-1] post = Post.objects.get(slug=slug) affiliates_context = AffiliateLinkConnectionSlug.objects.filter(slugs=post) if len(affiliates_context) > 0: aff_ids = [] for aff_id in affiliates_context.values_list('affiliate'): aff_ids.append(aff_id[0]) affiliates = AffiliateLink.objects.filter_by_lang().filter(id__in=aff_ids) print(affiliates) response.context_data.update({'affiliates_partners': affiliates[:2]}) # Updates posts lists def pagiscroll_handler(self, request, response): if response.context_data: affiliates = [] tags_names = request.GET.getlist('tag', []) tags = Tag.objects.filter(Q(name_ru__in=tags_names) | Q(name_en__in=tags_names) | Q(slug_ru__in=tags_names) | Q(slug_en__in=tags_names)) if len(tags) > 0: affiliates = getAllWithTags(AffiliateLinkConnectionTag.objects.all(), tags) if len(affiliates) > 0: aff_ids = [] for aff_id in affiliates.values_list('affiliate'): aff_ids.append(aff_id[0]) affiliates = AffiliateLink.objects.filter_by_lang().filter(id__in=aff_ids) response.context_data.update({'affiliates_partners': affiliates[:3]})
    But that won't be enough. The templates where the affiliate programs will appear need to include the appropriate pieces of code so the middleware can insert them. Here's what you'll need to insert:
    {% if isAffiliateLinkMiddlewareConnected and affiliates_partners|length > 0 %} <div class="border-r-2 border-solid"> <h2>{% trans "Партнёры" %}</h2> <hr> <div class="flex flex-col p-2 gap-3 grow basis-2xl"> {% include 'Affiliate/affiliate.html' with affiliates=affiliates_partners %} </div> </div> {% endif %}
    One more thing. I store all affiliate programs (links to them) in the database, under the AffiliateLink model. However, this model doesn't determine where each affiliate program should be placed. That's the responsibility of a different, specialized model, AffiliateLinkConnection*. There are three connector classes:
    1. AffiliateLinkConnectionSpecial - responsible for insertion on special pages, such as the homepage and about page.
    2. AffiliateLinkConnectionTag - responsible for insertion on pagination pages using tags.
    3. AffiliateLinkConnectionSlug - responsible for insertion into posts (Articles and Tools) using slugs.
    I could write out every line of code and paste it here, but that's not necessary. I've described the basic gist, and if you want to see how this application (Affiliate) works as a whole, you can download it here or visit my website repository and see how it works across the entire site.

    Now we need to wait

    Now we need to wait until I collect the necessary statistics and draw the appropriate conclusions. I'll probably be able to provide them in 2-3 months, plus something will probably happen that would be worth recording in this article.
    So, in the week since I started writing and editing this article, the following has already happened:
    1. My site was approved by Yandex Advertising Network. Which in itself requires a separate article.
    2. The invasion of Chinese bots on the site and how I blocked them using the .htaccess file. Read it, it'll be interesting.
    And who knows what else awaits this site in the future. So subscribe to the RSS feeds, the email newsletter, and don't forget to leave your comments on this matter. See you in 2-3 months. ( ̄︶ ̄)↗

    Do not forget to share, like and leave a comment :)

    Comments

    (0)

    captcha
    Send
    LOADING ...
    It's empty now. Be the first (o゚v゚)ノ

    Other

    Similar articles


    Monetize your files. Is it really possible earn money by sharing files?

    Clock
    03.03.2025
    /
    Clock
    11.03.2026
    An eye
    2537
    Hearts
    1
    Connected dots
    0
    Connected dots
    0
    Connected dots
    0
    In this article, I will tell and show on the example of my site how you can earn money on file-sharing services. And is it even possible? Let's analyze the …