Version 5.0
AdvertServe User Manual :: v5.0

Keyword Targeting - HTML Code Integration

Original Code

You should now have a generated HTML zone code from the code wizard that looks like the following:


<script type="text/javascript">
document.write('<scr'+'ipt src="http://adserver.example.com/servlet/view/banner/javascript/zone?zid=123&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'&referrer='+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+'" type="text/javascript"></scr'+'ipt>');
</script>

Modified Code

Within that code, you'll notice that it contains a URL that points to the ad server and it has several parameters. This will be similar for other HTML code formats as well. Look for <IFRAME>, <A> and <IMG> tags containing URLs if the code you have looks different.

What you need to do is add a parameter to this code on your search results page to pass the keywords that were searched for to the ad server.

Lets look at an example of the above code modified to pass the value blue coat,windbreaker,parka to indicate that the phrase blue coat along with the keywords windbreaker and parka were searched for.


<script type="text/javascript">
document.write('<scr'+'ipt src="http://adserver.example.com/servlet/view/banner/javascript/zone?zid=123&pid=0&keywords=blue+coat%2Cwindbreaker%2Cparka&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'&referrer='+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+'" type="text/javascript"></scr'+'ipt>');
</script>

Tip Tip

You should always URL encode the parameter value to ensure that the ad server interprets your keywords correctly.

Warning Warning

It is extremely important that the keywords parameter be added before the referrer parameter as shown in the example above. The ad server may misinterpret the referring page if it is not the last parameter. This is due to the fact that the ad server uses methods not standard to the HTTP URL specification to parse parameters in an effort to be compatible with third party ad servers that do not properly URL encode their tracking URLs.