Url

Introduction

Because ads are served through a URL, the URL itself is the meat of this documentation. We'll go through every part here in detail. Each part has a fixed position, a short identifier, and a long identifier — the identifiers can appear in any order, but the positional (unprefixed) shorthand always follows the fixed order described below.

User

If you have an account, you get a unique username you can use as an identifier wherever you post a link — a guest blog post, a YouTube description, a forum comment. Since those pages aren't yours, adding your username to the URL is what ties that traffic back to your account.

The username is a combination of one or more lowercase words separated by hyphens (in regex terms, [\w\-]+).

This is how the user part can be in the url:

/between-movies/
/u:between-movies/
/user:between-movies/

Company

After user in the hierarchy comes company — the affiliate provider. Fiverr is used as an example throughout these docs, but it could just as well be Amazon or Hostinger. Log in to see the exact list of affiliate programs currently available to you.

/fiverr/
/c:fiverr/
/company:fiverr/

If you want to show ads from a pool of multiple companies, separate them with a comma. This works best for 1–5 companies, so the URL doesn't get too unwieldy.

/c:fiverr,hostinger,audible,grammarly/

When you want a bigger pool, you can use the keyword in the same way instead, as described below.

Product

/pro/
/p:pro/
/product:pro/

Since product is almost always tied to a company, for instance the pro plan of fiverr, you can combine them as such:

/fiverr:pro/

We'd recommend against using product by itself unless it's something sold through many different affiliate providers, where which one handles it doesn't really matter — a PS5 or an RTX 4090, for instance.

Keyword

Instead of narrowing by company and product, you can narrow down by keyword — the ad is then matched by relevance to whatever you provide. Keywords can be multi-word slugs with hyphens, and their order matters: earlier keywords are weighted as more important than later ones. Keywords don't need to already exist in the system beforehand — new ones are recorded as they come in, so the matching pool grows over time.

/shoes/
/k:shoes/
/keyword:shoes/
/k:shoes,shirts,hats,clothes,green-color/

Type

Type defines what the service actually returns, out of a fixed set of options. If it isn't provided, we try to work it out automatically from the request itself (an <img> load looks different from a <script> fetch or a clicked link) — but you can always set it explicitly if you need to, and sometimes you will (see Prerequisites for when automatic detection can't be trusted).

/image/
/t:image/
/type:image/

Currently supported:

script: src of a <script> tag. This is the default when nothing else is given.

image: src of an <img> tag.

iframe: src of an <iframe> tag.

html: for server-side use — returns the ready-made HTML for an image/link pair in one response, rather than needing you to request each separately. For instance in PHP: file_get_contents('https://betweenaffiliates.com/t:html/c:fiverr/w:600/h:200/');

link: href of an <a> tag — the click side of an ad. If it's requested with the same parameters as a recent image request, we reuse that same ad so the two stay paired; otherwise a fresh one is resolved. Use this both for the wrapping anchor in the image and link method and for a plain, standalone affiliate link.

url: also the href of an <a> tag, but always resolved fresh with no attempt to pair with a prior image request — useful for a one-off redirect link that isn't tied to an image anywhere.

Width and height

Width and height are pretty straightforward, but there are a few variations worth knowing. When using bare, unprefixed numbers, width always comes first — so if you want to specify height only, you need the h: prefix rather than relying on position. Neither is required at all, for instance with the url type, but a random size will be picked for an image if you don't. Otherwise, you can specify width only, height only, or both: whichever one you leave out is filled in with a random value.

/600/200/
/w:600/h:200/
/width:600/height:200/

There is also one special case, that you can use the following if you want:

/600x200/

You can also limit width and height to a range if you're fine with a random ad within it. In the example below, you could be served anything from a 400x300 ad up to an 800x100 one.

/w:400-800/h:100-300/

One more detail worth knowing: for an exact width like 600, we actually match anything from 599 to 601, to also pick up ads that are just a pixel off. The same applies to height.

Ratio

As an extra, instead of width x height, you can provide the ratio. For instance 16:9, 3:2, 1:1, etc. In this scenario, you may get a bigger or smaller ad that is resized so it may not be the best option by itself, but together with either width or height it may be an alternative.

/16/9/
/r:16x9/
/ratio:16x9/

Version

Lastly, the version gives you control over caching. It's not required, but it's worth adding deliberately in most cases — unless you actually want the exact same ad shown every time. Each version number gets its own cached slot, so putting in a random number from 1–10 effectively picks from a rotating pool of 10 cached ads. Use the current date (e.g. 20260730) to cache the same ad for a whole day, or the current hour to rotate hourly. We'd recommend keeping some caching in place, both for your own performance and ours — using something that changes every second (a raw timestamp, say) would defeat caching entirely, and we may have to step in if that causes real load. If no version is given, one is assigned at random from a pool of 100.

/10/
/v:10/
/version:10/

If /10/ is used and there is no width or height specified, it will not work as width or height will be assumed.

It's important that if you're pairing an image with a link (see Image and link), the two URLs stay otherwise identical, version included — that's what lets us group them together as one ad.

The cached version will stay in cache for 24 hours.

Shorthand

To make building the URL as compact as possible, we also support a fully positional shorthand that strictly follows the order these parts appear in throughout this doc. You can write the whole URL like this:

/between-movies:amazon:adidas:white,black:script:600:200:10/

It is however not recommended as it can be difficult to see what is for what, and thus guarantee that it will work as intended.

You can also log in to the system and define your own links, by giving the ad a personal slug making it work like you defined. So, if you did the work, the above can be written like this:

/between-movies/adidas-shoes/