I think they just generate code along with the page that uniquely selects an ad. Most sites just include some random javascript that asks the ad server to put an ad on the page.
Incidentally, while looking at the code Reddit sends, I noticed this gem:
Incidentally, while looking at the code Reddit sends, I noticed this gem:
Of course, pixel.reddit.com is adblocked also, so this has no effect...