Your program’s cookie duration now sets the attribution window

Affiliatops team · · 4 min read

The same day-45 sign-up: missed under the old fixed 30-day cookie, credited once the program’s 90-day setting applies.

Every program in Affiliatops has a Cookie Duration (days) field on the Programs page. It is meant to decide how long a referral click keeps crediting the partner who sent it. Until today’s fix, it didn’t: both our tracking script and our /r/ referral links set the referral cookie for a fixed 30 days, whatever the program said.

That was a bug, and it’s the kind that matters, because the attribution window is part of the deal you offer partners. If you promised 60 days and set 60 days, a customer who bought on day 45 should have credited the partner, and in the tracking cookie it didn’t. This post covers what we changed, how the window is now decided, what you need to do (nothing, in most cases), and how to choose a window if you never gave it much thought.

What changed

There are two ways a referral cookie gets set in Affiliatops, and both ignored the setting.

  • Referral links (/r/ followed by the partner’s code) redirect the visitor to your site and set an attribution cookie. That cookie was hardcoded to expire after 30 days.
  • The tracking script on your site reads the ref parameter from the URL and stores the referral code in a cookie. It also used a fixed 30 days.

Both now use the partner’s program window. The /r/ link sets its cookie for that many days directly. The tracking script works in two steps: when a visitor lands with a referral code, it stores the code for 30 days straight away, then reports the click to our referral endpoint. That endpoint now answers with the program’s attribution window, and the script sets the cookie again with that number of days. If the request fails, the 30-day cookie stays, which is what every cookie got before the fix.

The tracking script is now version 1.4.0. Our older tracker script, still served for sites that installed it under its previous name, got the same change.

How the window is decided

The window belongs to the partner who sent the click, so we look it up from that partner, in this order:

  1. 1

    The partner’s program

    If the partner belongs to a program with a Cookie Duration of at least 1 day, that number is used.

  2. 2

    The workspace setting

    Partners with no program, or a program without a usable value, fall back to the workspace-wide cookie duration.

  3. 3

    30 days

    If neither is set, the window is 30 days, the same default new programs start with.

Whatever the source, the window is capped at 365 days. Browsers limit how long a cookie can live (Chrome caps it at 400 days), so a longer setting would not survive in the browser anyway, and a year is the most that is useful. Values are rounded down to whole days, and anything under 1 day is ignored in favour of the next fallback.

What you need to do

Most likely nothing. The install snippet loads the tracking script from our servers, so every site using it picked up the new version as soon as it shipped. Referral links are handled on our side and needed no change on yours.

Two things are worth knowing:

  • Cookies set before the fix keep their original 30-day expiry. A visitor’s cookie picks up the program’s window the next time they arrive through a referral link, which sets it again.
  • If you copied the script onto your own server instead of loading it from ours, replace your copy with the current one. Otherwise your cookies will keep lasting 30 days.

It is also a good moment to check the number itself. If you entered a Cookie Duration months ago and forgot about it because it seemed to make no difference, it now does. Look at each program on the Programs page and make sure the window is the one your partner terms promise.

How to choose a window

The right window is roughly how long your customers take to decide. For a low-cost product people buy on the spot, 30 days is generous. For B2B software with a trial, a team evaluation or a procurement step, 60 to 90 days is common, because the purchase can land weeks after the first visit.

Longer windows attract partners who write in-depth content, since their readers often come back later. They also mean you pay for some purchases the partner had little to do with. Pick a window you would be comfortable defending in your partner terms, and keep it stable once partners have signed up under it.

Our guide to affiliate attribution and cookie duration covers typical windows by product type, how last-click attribution works, and what cookies can’t see. If you track Stripe subscriptions, Stripe affiliate tracking explains how a click becomes a paying customer, and the glossary defines the terms partners will ask about.

Why we missed it

The setting was saved and shown correctly on the Programs page, so it looked like it worked. The cookie code lived elsewhere and had its own 30, and nothing connected the two. The fix puts the window in one place that both the referral links and the tracking scripts read from, and we added tests that check a program’s setting actually reaches the cookie.

If you ever find a setting in Affiliatops that seems to do nothing, tell us. We would much rather hear about it than have you work around it.

Related guides

More from the blog

Run your partner program on Affiliatops

Recurring commissions, refund holds and clawbacks, and a branded partner portal, from $19 a month. Try it free for 14 days.

Start free trial