I often get questions that might be relevant to more than just one person. That’s why I have decided to start answering these questions on this blog. I’ve created a new Q&A category, I hope to be able to add more posts shortly.

Lorand Minyo from Romania sent me this question:

I have a campaign running on multiple sites with different publishers, with two banners in rotation. These publishers run the invocation code on their sites and I use Revive Adserver to count views and clicks. However, I’d like to give each of the publishers the ability to have a different link for the same banner – for example publisher 1 using banner X and have the link myurl.com?affid=1, publisher 2 using the same banner X and have the link myurl.com?affid=2 and so on. This would be particularly useful, since I want to count views and clicks in Revive Adserver and record transactions in my billing system. So my question is: Can you have different links for the same banner or different links for different zones?

Lorand, this is possible, and it is not even all that hard to implement. I suggest we use two techniques that are not very well known: site variables in zone invocation code and magic macros in banners. I will explain both below.

Adding publisher details to Revive Adserver invocation code

When Revive Adserver generates the invocation code for a zone, one line of that code contains the ID of the zone in question:

document.write (“?zoneid=1”);

What many people don’t know is that you can add extra parameters to the line of where Revive Adserver placed the zone ID. Here is an example that could be used for the scenario that Lorand described:

document.write (“?zoneid=1&pubid=X”);

Just send each publisher instructions to replace the capital X with the number that you want them to use, so that you can uniquely identify them. Any time Revive Adserver is processing an ad request for this zone, it ‘knows’ the extra bit of information, in this case the value of the variable named “pubid”.

Dynamically altering a banner or link

Now that we have the publisher’s ID in Revive Adserver during ad processing, we need a way to insert this ID into the banner. There is a little known feature called “Magic Macros” that can do just this.

Let’s assume you have a banner in Revive Adserver (it might be an image banner with a destination URL specified, but it could just as well be an HTML banner). The link would like something like this:


What Magic Macros can do is simple, let me give you the example and you’ll see right away:


Whenever a banner with this magic macro is delivered through a zone that’s called with the special version of the invocation code described above, Revive Adserver will automatically replace the magic macro with the value of the pubid variable. So if the zone is called like this:

document.write (“?zoneid=1&pubid=abc”);

The banner will be delivered with this link: