Adding OASIS Ads to Your Site's Pages

Method 1: IMG Tagging

The simplest way to incorporate OASIS banners on your site is to use IMG tagging. In this scenario, your OASIS server can be a standalone server separate from your Web server. The drawback is that you don't get to use ALT tags, and you can't serve rich media. In addition, you have to use cookies to record what banner a user last saw. This can be somewhat unreliable and can lead to erroneous clickthroughs.

In the pages of your Web site, you add tags like this:

<A HREF="http://oasis.yourdomain.com/oasisc.php?s=35&w=468&h=60"><IMG SRC="http://oasis.yourdomain.com/oasisi.php?s=35&w=468&h=60" WIDTH=468 HEIGHT=60 BORDER=0></A>

There are two components, the impression URL and the clickthrough URL. The impression URL is "/oasisi.php" (on your OASIS server), and the clickthrough URL is "/oasisc.php" (also on your OASIS server).

Each takes three CGI arguments:

Note that it is critical that these three arguments match up in the impression URL and the clickthrough URL.

If you're going to serve ads from OASIS using IMG tags, you really should consider adding a random number to the URLs you're using. OASIS does a lot of things to prevent caching of banners, but in order for those to have an effect, you've got to get your visitors to contact the server. Let's look at an example:

<A HREF="http://oasis.yourdomain.com/oasisc.php?s=35&w=468&h=60"><IMG SRC="http://oasis.yourdomain.com/oasisi.php?s=35&w=468&h=60" WIDTH=468 HEIGHT=60 BORDER=0></A>

The first time a visitor hits this link, his browser will contact the OASIS server and get a banner ad. If the ad is animated (as so many banners tend to be), OASIS will not be able to send cache-busting HTTP headers (doing so causes bizarre looping of banners in many browsers). The second time the visitor's browser sees these tags, it may decide, "hey, I've got this in cache, so there's no need to contact this OASIS server". The visitor sees the same tired banner ad.

A solution is to put a random number into the URL for OASIS. You have to do this in a safe manner (you don't want the random number to interfere with the normal behavior of OASIS). The best way to do this is to create a new CGI variable (let's use "cb") and tack it on to the OASIS URL:

<A HREF="http://oasis.yourdomain.com/oasisc.php?s=35&w=468&h=60&cb=123456"><IMG SRC="http://oasis.yourdomain.com/oasisi.php?s=35&w=468&h=60&cb=123456" WIDTH=468 HEIGHT=60 BORDER=0></A>

There are different ways to add this random number. If you can afford the CPU cycles, you can use a program to generate a new random number each time a visitor loads a page (and using SSI to include it on the page). If your pages are dynamically generated, you can use your programming language's features to include the random number. You can have static SSI files that are rewritten periodically by a process running on your Web server. Or you can have a program rewrite the pages themselves. Use whatever method suits your site best.

Method 2: IFRAMEs and ILAYERs

The IFRAME is an MSIE-only tag. It allows you to pull HTML content from another URL into your document. It doesn't actually incorporate the content directly into the document, but it does make it appear to be on the same page as the rest of the document.

Since Netscape Navigator will not honor the IFRAME tag, you have to provide a backup tag. MSIE will ignore the backup tag and will only display the IFRAME content.

Here's an example:

<IFRAME SRC="http://oasis.yourdomain.com/oasisi-i.php?s=35&w=468&h=60" MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=NO WIDTH=468 HEIGHT=60> <A HREF="http://oasis.yourdomain.com/oasisc.php?s=35&w=468&h=60"><IMG SRC="http://oasis.yourdomain.com/oasisi.php?s=35&w=468&h=60" WIDTH=468 HEIGHT=60 BORDER=0></A> </IFRAME>

MSIE will create a 468x60 IFRAME and fill it with content from

http://oasis.yourdomain.com/oasisi-i.php.

Navigator will ignore the IFRAME tag and display what comes between the <IFRAME> and the </IFRAME> tags. This is a nice hybrid approach between method 1 and method 3. You get most of the advantages of embedded ad serving (for users of MSIE), with the convenience of a standalone ad server.

You can expand upon this method with the ILAYER tag, a Netscape-only tag. In the following example, Netscape will use the ILAYER section and ignore the NOLAYER section. IE will use the IFRAME section inside the NOLAYER section. Other browsers will fall through to the IMG tag between the IFRAME tags.

<NOLAYER>
<IFRAME SRC="http://oasis.yourdomain.com/oasisi-i.php?s=8&w=468&h=60"
WIDTH=468 HEIGHT=60 FRAMEBORDER="no" BORDER=0 MARGINWIDTH=0
MARGINHEIGHT=0 SCROLLING="no"><A
HREF="http://oasis.yourdomain.com/oasisc.php?s=8&w=468&h=60"><IMG
SRC="http://oasis.yourdomain.com/oasisi.php?s=8&w=468&h=60"
BORDER=0 WIDTH=468 HEIGHT=60></A>
</IFRAME>
</NOLAYER>
<ILAYER ID="layer1" VISIBILITY="hidden" WIDTH=468 HEIGHT=60></ILAYER><P>
<LAYER
SRC="http://oasis.yourdomain.com/oasisi-i.php?s=8&w=468&h=60"
WIDTH=468 HEIGHT=60 VISIBILITY="hidden"
onLoad="moveToAbsolute(layer1.pageX,layer1.pageY);clip.height=60;clip.width=468;visibility='show';"></LAYER>

When using IFRAMEs with rich media, you must be sure that the code for your rich media includes TARGET="_top" (or TARGET="_new") in every hyperlink. Otherwise, the clickthrough URL will open inside the IFRAME itself.

Some users have reported problems with the ILAYER tag in some versions of Netscape Navigator 4.7x. For more discussion on the topic, see https://sourceforge.net/forum/forum.php?thread_id=646644&forum_id=29988.

Method 3: Embedding OASIS Ads

If you want to place OASIS ads on PHP-generated pages, and if OASIS is running on the same server you use to serve your site, you can use embedded PHP calls. This method has some real advantages:

To do this, you must put the following tags at the very top of your document (don't even put in any whitespace before this code):

<?php
require("/home/webdocs/oasis/oasisi-e.php");
$ad = get_creative(5, 468, 60, '');
?>

In the call to get_creative(), you pass the section number, the width and height of the desired creative, and an optional frame target.

It's critical that the code be the very first thing in the document, since the code may need to spit out a cookie for the user. With PHP, any whitespace preceding this block of code will be output to the user before the code is executed, thereby preventing the cookie from being set.

Once you've made the call to put the creative into a variable, you can place it on the page in this way:

<?php echo $ad; ?>
If you have multiple sections on a single page (for example, "homepage left" and "homepage right"), you just need to get both ads into different variables in the first block of code:

<?php
require("/home/webdocs/oasis/oasisi-e.php");
$ad1 = get_creative(5, 120, 90, '');
$ad2 = get_creative(6, 120, 90, '');
?>

Then you can place the ads wherever you want with this:

<?php echo $ad1; ?>

and this:

<?php echo $ad2; ?>
Specifying a frame target will generate an <A HREF> tag with a "TARGET" modifier. This works best for Image banners, but it can also work for rich media -- when OASIS serves rich media, it modifies any "A HREF" in the rich media to insert a "TARGET" modifier. Here's a sample call to get_creative() that specifies a frame target:

<?php
require("/home/webdocs/oasis/oasisi-e.php");
$ad = get_creative(5, 120, 90, '_TOP');
?>

Method 4: Remote Javascript Invocation

Most modern browsers will allow your Web page to invoke a Javascript source file from another URL. You can use this to insert an OASIS banner into your page.

<SCRIPT LANGUAGE="JavaScript"
SRC=http://oasis.yourdomain.com/oasisi-j.php?s=1&w=468&h=60">
</SCRIPT>
<NOSCRIPT>
<A HREF="http://oasis.yourdomain.com/oasisc.php?s=1&w=468&h=60"><IMG
SRC="http://oasis.yourdomain.com/oasisi.php?s=1&w=468&h=60"
WIDTH=468 HEIGHT=60 BORDER=0></A>
</NOSCRIPT>

Note the NOSCRIPT section for browsers not supporting Javascript.