Jump to content

Custom Query Parameters

Dan Wright

Recommended Posts

I am trying to use customer query parameters in ads.

I have an HTML ad that is actually a form with hidden variables that need to be populated via the get parameter. The goal is that any parameters sent to the site, those parameters will be inserted into hidden form fields in the ad so they can be sent to another site and tracked properly throughout the lead flow.

So, when a page is loaded with "http://www.sitename.com/?pq=1 I need to populate a hidden form field in the banner ad (an HTML form) so it looks like <input type="hidden" name="pq" value="1">

I read about Magic Macros and it seems as though if I change the zone invocation code to "Revive Adserver" and then put something like {pq} in my banner ad, it will echo whatever I put in that field in the banner ad. I tried this by simply inserting {pq} in my banner ad, but it renders it as {pq}.

What am I missing? Is this even possible? Do I need to approach it another way? Will I need to ad my own 3rd party ad server to consume these custom query parameters?

Thanks in advance.

Link to comment
Share on other sites

The list of magic macros that you can use in ad code:

'{timestamp}','{random}','{target}','{url_prefix}','{bannerid}','{zoneid}','{source}', '{pageurl}', '{width}', '{height}', '{websiteid}', '{campaignid}', '{advertiserid}', '{referer}'
'{clickurl_enc}' '{logurl}' '{logurl_enc}'

Custom variables' values should be specified in zone code (from your description I do not see that you did this at any point)

In case of acynchronous code:
Add data-revive-pq="yourvalue" to INS tag.

For example:

<ins data-revive-zoneid="96" data-revive-pq="yourvalue" data-revive-id="...."></ins>
<script async src="//deliveryserver.com/delivery/asyncjs.php"></script>


In case of synchronous JavaScript code:

Modify the line    document.write ("?zoneid=...."); and add &amp;pq=yourvalue to it:

For example:

   document.write ("?zoneid=96&amp;pq=yourvalue");


In case of Iframe code:

add &pq=yourvalue to iframe SRC attribute, so that it would be something like: http://deliveryserver.com/delivery/afr.php?zoneid=96&pq=1

For example:

<iframe id='a8db14c8' name='a8db14c8' src='http://deliveryserver.com/delivery/afr.php?zoneid=96&amp;pq=yourvalue&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;ct0=INSERT_ENCODED_CLICKURL_HERE' frameborder='0' scrolling='no' width='320' height='480'><a href='http://deliveryserver.com/delivery/ck.php?n=a1e44614&amp;cb=INSERT_RANDOM_NUMBER_HERE' target='_blank'><img src='http://deliveryserver.com/delivery/avw.php?zoneid=96&amp;pq=yourvalue&amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;n=a1e44614&amp;ct0=INSERT_ENCODED_CLICKURL_HERE' border='0' alt='' /></a></iframe>


Good luck


Link to comment
Share on other sites

This is very helpful, thank you!

I modified my invocation code for my async js code and now have "5" in the code when I hard code 5 in the input variable as you suggested, so now 


I read that I could substitue any part of the PHP request array ($_GET, $_POST, $_COOKIE) with {ANY_INPUT_VARIABLE} so, I was thinking I would be able to somehow get the request for the page the ad is loaded from to have its input $_GET show up in the ad.

So, an ad that's loaded from http://www.mypage.com/index.html?pq=5 using the async javascript code with data-revivie_pq={5} would load in the ad. It seems like I might have to write some javascript or jquery to grab the get parameters from the URL and then load them into my revive invocation code. Does that sound correct?

Thanks again for your help.




Link to comment
Share on other sites

Thank you, firstimpression!

I figured that using PHP to write those values would work the best for this implementation and have that working now.

However, setting the banner to "Generic HTML" causes the results of the form submission to load within the iframe using async javascript invocation. When I switch it to "Don't touch HTML", it loads in the _blank frame as I have specified in the invocation code as well as the <form> tag, but passes in un-touched custom variables.

Any idea how I can target a new frame as well as pass in the custom variables?

Thanks again for your help.

To see it, go here:


Scroll to "Search 1" and fill it in and submit.



Link to comment
Share on other sites

  • 2 years later...


i have a question to the site variable.

I use the asynchronus modus. One variable is the keyword. I named it "thema". Also i implememted in my code:


But i have Wordpress and use two or three keywords for a post. For Example "Reisen", "Rostock", "Katze".

My banners should be displayed on a post with "Rostock". An other banner should displayed on a post with "Katze". Also should both displayed on this post.

Is it possible to use an array for keyword and which syntax do i need?

Greetings & Thanks


Link to comment
Share on other sites

  • 5 months later...
1 minute ago, andrewatfornax said:

Two ideas:

1. Use two (or more) different variables, e.g. "reisen=true", "rostock=true", "katze=true". Then you can target accordingly.

2. Combine everything into one variable, e.g. "thema=reisen|rostock|katze". Then you can target accordingly using the "contains" or "regex" options.

Thank you so much! I'll try that ?

Link to comment
Share on other sites

  • 1 year later...

Hi! great topic! :-)))

At the moment i'm using {websiteid} macro but i'm searching for a way to insert websitedomain into url (i need this to insert websitedomain as utm_source for banner

At the moment, as i wrote, i'm using websiteid and i have a link like below (this is still good but then i have to go to revive and manually match website with id 1 website with id 2 and so on with theyr urls)

  • website 1 banner link: https://myreviveadserver.com/ck.php?oaparams=2__bannerid=XX__zoneid=XX__cb=XXXXXXXXXX__oadest=www.mysite.it/weekend.html?utm_src=1
  • website 2 banner link: https://myreviveadserver.com/ck.php?oaparams=2__bannerid=XX__zoneid=XX__cb=XXXXXXXXXX__oadest=www.mysite.it/weekend.html?utm_src=2

what i'd like to do is to get domain names instead of ids. this is an example:

Campaign: weekend_offers
link: www.mysite.it/weekend.html
banner placed on www.website1.com and www.website2.com

  • website 1 banner link: https://myreviveadserver.com/ck.php?oaparams=2__bannerid=XX__zoneid=XX__cb=XXXXXXXXXX__oadest=www.mysite.it/weekend.html?utm_src=website2.com
  • website 2 banner link: https://myreviveadserver.com/ck.php?oaparams=2__bannerid=XX__zoneid=XX__cb=XXXXXXXXXX__oadest=www.mysite.it/weekend.html?utm_src=website1.com

it would be great, for example, to add a custom macro to call {websitedomain}... is it possible?

i have php skills and i thought to edit mysql affilaites table to add another field called domain and then to create a new macro...but i don't know which php file to edit :-(

thanks so much!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...