TweetFollow Us on Twitter

Easy Web Ad Management

Volume Number: 15 (1999)
Issue Number: 7
Column Tag: Web Development

Easy Advertising Management

By Kelly Konechny
Edited by John O'Fallon, Maxum Development

How to build an ad management system using NetForms and NetCloak

Tracking Ads, Views and Click-Thrus Automatically

Managing advertisements on a Web site can be a job in itself for Webmasters. Generating regular reports for sales staff of views, click-thrus, where an ad resides on the site, and the length of time that they are scheduled to be there can swallow up your time. Building an advertisement management system can help a Webmaster juggle ads and save vast amounts of time that would normally be spent on formatting reports and distributing them to the appropriate people. Using NetCloak Professional from the folks at Maxum, you can develop an advertising management system to help you better track ads and save some time.

In the examples below I presume you are operating a Mac webserver running Maxum's http://www.maxum.com/ NetCloak and NetForms, or the product combining the functions of both, NetCloak Professional. Before building the system consider a few things about your Web site. Take account of all advertisers, their specific ads, and the ad's placement on your Web site (if you haven't done so already). This information will always be useful, and it should be incorporated into your ad management system.

Counting an ad that is viewed

Start by making a list of pages on the site that contain ads. This will not only help you in this project but will prove handy for future reference as well. You will need to place a counter on all pages that contain ads in order to count views of the ad. Counters can be reset or set to an initial value if you wish using NetCloak's "List Management" window.



Figure 1. The Edit Lists dialog allows you to control all your counters from one window

Under NetCloak's Configuration menu choose Edit Lists (Figure 1). This is where you will maintain all of your counters. You can click on a counter name to see the current value, and even change or remove the counter entirely.

On each page that will include an ad banner, place a counter in between the <HEAD> and <BODY> tags of your HTML. The text for the counter will look like this:

<INSERT_COUNT* mainpage>
The counter should be placed in your HTML like this:

Sample page with counter
<HTML>

<HEAD>
	<TITLE>Main Page</TITLE>
</HEAD>

<INSERT_COUNT* mainpage>

<BODY>
</BODY>

</HTML>

Give each page its own counter and unique counter name. The counter name is the only way that NetCloak Professional identifies individual counters. If you happen to have two counters with the same name you may be tracking numbers incorrectly, so be sure that each counter name is unique.

Redirecting helps track clicks

In order to track views and click-thrus, two counters are needed: one for the page on which the ad is located, and one for the ad itself to track click-thrus. Click-thrus are difficult to account for because they typically point to another Web site. The way to account for click-thrus is a bit sneaky. To track a click through we need to count the clicks on the ad by using a "redirect". Instead of having the ad banner linked to the advertiser's Web site directly, the ad link is set to a special redirect page that exists on the local server. This page will never be seen by end users, and is used simply to count the ad click through and then redirect to the advertiser's Web site. The link for the ad will look like this:

Link for an ad

<A HREF="http://www.yoursite.com/adXredirect.htm">AD IMAGE SOURCE</A>

The link is specific to your site of course, and the filename "adXredirect.htm" would be changed to reflect the advertiser, since you may have many different advertisers on your site. You could create one redirect for all of an advertiser's ads, but that may not be specific enough since it would only show the total number of times that all of their ads were viewed and clicked on. You will find that making separate redirects for each ad will be much more beneficial because it is more specific. Once this is done you are ready to build your redirect page.

The redirect page consists of only two lines of code. The counter (<INSERT_COUNT* clientX_adX_count>) will indicate the total number of clicks on the ad, and the redirect will take the user to your advertiser's Web site. The redirect page will look like this:

Redirect page

<INSERT_COUNT* clientX_adX_count>
<REDIRECT "http://www.clientswebsite.com/">

You will need a unique name for each ad's counter so a simple system of naming should be established. Remember to ensure that all counter names are unique to avoid confusion when the actual counts are being recorded.

Basically, this redirect page counts the click on the ad with the <INSERT_COUNT* clientX_adX_count> and then redirects the user to the client's Web site at http://www.clientswebsite.com. This will happen so quickly that the user will most likely not even notice that their one click has actually taken them to a hidden page before reaching the real destination. You are now tracking click-thrus.

Once this task is completed, you are counting views and click-thrus for every ad on the site. Depending on the number of ads on the site you may have a lot of redirect files on your server. It's best to create a folder or directory to store all of the ad tracking files, just to keep things clean and organized. It will also make updating the files quite a bit easier. Now you are ready to move to the next part of building the ad management system: displaying the views, and click-thrus for every ad.

Placing the ad graphic on the page To ensure that the advertisement is being tracked properly, each of your ad's links needs to be pointed to the redirect page. You will need to enter in the link to the advertiser's Web site along with the advertiser's graphic. The code will look like this:

Ad system link and graphic reference

<A HREF="/AdSystem/redirectclientX-1.htm">
<IMG src="/adsystem/clientxbanner150-1.gif" WIDTH="150" HEIGHT="80" BORDER="0"></A>

By doing this, clicking on the ad takes you to the redirect page, which counts your click and then sends the user off to your advertiser's Web site. You can also modify the code for the ad and the redirect if your advertiser wishes to rotate between two banners. This again is done with NetCloak. The trick to doing this is to to use NetCloak's <SHOW> and <HIDE> tags with the random feature. The code will look like this:

Ad system rotation code

<HIDE><SHOW_RANDOM 50><A HREF="/AdSystem/redirectclientX-1.htm">
<IMG src="/adsystem/clientxbanner150-1.gif" WIDTH="150" HEIGHT="80" BORDER="0"></A>

<HIDE><SHOW_SAMERAND 50><A HREF="/AdWSystem/redirectclientX-2.htm">
<IMG src="/adsystem/clientxbanner150-2.gif" WIDTH="150" HEIGHT="80" BORDER="0"></A>

The <SHOW_RANDOM 50> tag is used to show the first ad 50% of the time while the <SHOW_SAMERAND 50> tag displays the other ad 50% of the time. This gives you an easy way of automatically rotating the two banners while still tracking each one's individual click-thrus because of the different redirects. Now we are ready to built the page that will hold the advertising statistics we are now tracking.

Protecting your numbers

Take into consideration that only selected people should be allowed to view this page of views and clickthroughs of ads on your site, so requiring a user name and password will be necessary. Place the following tag before the tag in your HTML in order to protect the page:

<REQUEST_PASSWORD "Name of page or title" "Username,Password">

Once this tag has been placed into the HTML page, users visiting that URL will be prompted by a dialog box (Figure 2) asking for the user name and password for access to that page.



Figure 2. Protecting your page of views and clickthroughs is a must.

Displaying views and clickthroughts

Displaying the views and clickthroughs of ads on your site is actually very simple. NetCloak Professional has two different <INSERT_COUNT> tag variations. The one we were using above, <INSERT_COUNT*>, increments a counter, while the other, <INSERT_COUNT#>, displays the counter without changing it's value. When displaying the results of each counter we will need to use <INSERT_COUNT#>. Depending on your site or your preferences you may want to set up a separate page for tracking each advertiser's views and click-thrus, but I prefer to have it all on one page for convenience's sake.

The code for displaying counts for each advertiser looks like this:

<INSERT_COUNT# mainpage>
<INSERT_COUNT# clientX_adX_count>

These tags will display the number of views and click-thrus at that moment (Figure 3), and if you were to click reload in your browser, you may even see the numbers change. You are now tracking views and click-thrus dynamically.



Figure 3. Your views and click-thrus protected page will have updated information for ads on your Web site.

Organize the Information

If you are offering this page as an ever-changing report, take the time to format the information suitably, including the advertiser's name, the name of the specific ad, and the placement of the ad. For a standard column report use the table shown below:

Standard column report table

<TABLE>
<TR>
<TD WIDTH="140" ALIGN="TOP" VALIGN="TOP>NAME OF ADVERTISER</TD>

<TD WIDTH="140" ALIGN="TOP" VALIGN="TOP>NAME OF AD</TD>

<TD WIDTH="115" ALIGN="CENTER" VALIGN="TOP><A HREF="http://www.advertisers_site.com">www.advertisers_site.com</A></TD>

<TD WIDTH="80" ALIGN="CENTER" VALIGN="TOP"> <INSERT_COUNT# mainpage></TD>

<TD WIDTH="80" ALIGN="CENTER" VALIGN="TOP><INSERT_COUNT# clientX_adX_count ></TD>

</TR>
</TABLE>

Once this is done for all the ads on your site, you will end up with an up-to-the-minute report of views and click-thrus for each advertiser on your Web site that is easily distributed to a group of individuals that you have selected.

Updating Information in Your Ad Management System

Once the page of views and clickthroughs has been established you may be faced with another concern: adding new advertisements to the ad management system. When a new advertisement is ready to go on the site, it can make for a lot of redundant work for you to place it into the existing ad management system using HTML, especially if you are trying to place numerous ads from different advertisers into the system. That either means a lot of typing, or a lot of copying and pasting data to reflect a new advertiser. Well, with a bit of planning we can kill this redundant, time wasting task of updating information, and replace it with a simple way of updating advertiser information, after we consider exactly what information has to change.

There are really only two things in our system that need to change when we encounter either a new ad or an advertiser that needs to be added to the ad management system. A new redirect page has to be made with the specific counters, and an external link to our advertiser's Web site must be added. Also, the advertiser needs to be added to the ad management's summary page of all our advertisers. This addition can be as easy as an extension to the table that I showed you above using, of course, the correct information regarding that advertiser's counters.

After taking into consideration exactly which information it is that must change, we can now utilize a few of NetCloak Professional's other capabilities. We will use these capabilities to create a form that easily updates the counters and creates a new redirect page based on the information we give it.

A bit of planning goes a long way

We need to pre-plan a few things before we can begin this portion of the ad management system. As noted above, there are two things that need to be created in order to automate the system. These two things are new counters for each ad, and new redirect pages for each ad. We must consider the information that comprises the counters and redirect pages so we know exactly how to build the automation. After reviewing the counters and redirect pages, we see that we will need to define the following information for NetForms (or NetCloak Pro, as of version 3.0):

*	Advertiser's name
*	Advertisement's identification or name
*	The page that the ad appears on
*	A link (in HTML) of the page that the ad is on
*	Unique counter name for the ad
*	Page counter's name
*	Advertiser's link to their site (in HTML)
*	Redirect page name

Before you continue, you should protect the page containing the form with a password, since you don't want just anyone updating your ad management system. The method for protecting the page is discussed earlier in the article.

Building the form that builds the updates

We will start by creating the page in which we will enter all of the above information into a form for automatic updates. The update form can be as simple or as elaborate as you like. For simplicity's sake, the example shown here is very basic and uses the simplest HTML possible. Keep in mind that the naming of each variable is entirely up to you, and choosing variable names that make sense to you will always make your job easier.

UpdateBuilder.html

<FORM ACTION="/NetForms.acgi$/AdSystem/AutoUpdate.FDML" METHOD=POST>

<P><B>Advertiser's Name</B>

<INPUT TYPE="text" NAME="advertiser" SIZE=40 MAXLENGTH=200>

<P><B>Advertisement's Name</B>

<INPUT TYPE="text" NAME="adname" SIZE=40 MAXLENGTH=150>

<P><B>Page that the ad appears on</B>

<INPUT TYPE="text" NAME="pageadappears" SIZE=40 MAXLENGTH=150>

<P><B>Page's HTML for link</B>

<INPUT TYPE="text" NAME="pageHTML" SIZE=40 MAXLENGTH=150>

<P><B>Counter name for ad</B>

<INPUT TYPE="text" NAME="countername" SIZE=40 MAXLENGTH=150>

<P><B>Page counter name</B>

<INPUT TYPE="text" NAME="pagecountername" SIZE=40 MAXLENGTH=150>

<P><B>Advertiser's Web site (to be linked to)</B>

<INPUT TYPE="text" NAME="advertiserslink" SIZE=40 MAXLENGTH=150>

<P><B>Redirect page name</B>

<INPUT TYPE="text" NAME="redirectpagename" SIZE=40 MAXLENGTH=15

<INPUT TYPE=submit name="[add]" VALUE="Place New Advertiser">

<INPUT TYPE=reset VALUE="Clear Form">

</FORM>

It's a very basic form, with one input field for each bit of information noted above. The form is set to post to a file called AutoUpdate.FDML. This file will determine how and where your data gets updated.

FDML files make the data work

The FDML (Forms Definition Markup Language) file tells NetForms how to format and handle all the data from the form. It is time now to build our FDML file, the heart of the automation. Since the FDML controls your data, be sure to pay close attention to it when it's being built; even small mistakes can result in some lengthy troubleshooting. The FDML page will appear as follows:

AutoUpdate.FDML

<CREATEDOC>"/AdSystem/<REPLACE advertiser>/<REPLACE_FN redirectpagename>.htm"</CREATEDOC>
<MENUDOC "<!--ADDADVETISERHERE-->">"/AdSystem/AdSystemDisplay.htm" 

<TR>
<TD WIDTH="140" ALIGN="TOP" VALIGN="TOP><REPLACE advertiser></TD>

<TD WIDTH="140" ALIGN="TOP" VALIGN="TOP><REPLACE adname></TD>

<TD WIDTH="115" ALIGN="CENTER" VALIGN="TOP><A HREF="<REPLACE advertiserslink>"><REPLACE advertiser> </A></TD>

<TD WIDTH="80" ALIGN="CENTER" VALIGN="TOP"> <INSERT_COUNT# <REPLACE pagecountername>></TD>

<TD WIDTH="80" ALIGN="CENTER" VALIGN="TOP><INSERT_COUNT# <REPLACE countername ></TD>

</TR>

</MENUDOC>
<RESPONSE>"/AdSystem/Response.htm"</RESPONSE>


<INSERT_COUNT* <REPLACE countername>
<REDIRECT "<REPLACE advertiserslink>">

The FDML document begins with its primary directive, the <CREATEDOC> tag. This tag tells NetForms to create a new document in the path listed right after the tag. The <REPLACE> tags (used all over the FDML document) place the data from the field listed in the tag, in that position. For example a <REPLACE advertiser> tag would place the advertiser's name that we entered in the form where the replace tag is. The <REPLACE_FN> tag determines the name of the file, and is usually followed by a field name from the form.

The <MENUDOC> tag tells NetForms to add HTML to a predetermined spot in an existing HTML document. The "<!--ADDADVETISERHERE-->" comment following <MENUDOC> is the specific line that NetForms will look for in the destination document so that it knows exactly where to place the HTML. The path following the " <!--ADDADVETISERHERE-->" tag is the location of the document that NetForms will add this HTML to. In this case, it is our views and click-thrus display page. The HTML that follows is the preset HTML that we are using to update the display page. Inside the HTML we are using the various <REPLACE> tags so that the information we filled out in the form will be transposed to the correct place on the views and click-thrus page. The <RESPONSE> tags simply point to a file that is to be displayed after submitting the form. And the HTML following that is the preset code that will be placed in our automatically created redirect page.

The last step in building the automation, and linking the views and click-thrus display page to the FDML, is to define where NetForms will place the data in the views and click-thrus display page using the "<!--ADDADVETISERHERE-->" tag. Place the "<!--ADDADVETISERHERE-->" tag inside the table we built previously on the views and click-thrus display page, and NetForms will drop in all updates after that tag.

What we have, and how we have it

We now have a page with a form that posts to a FDML document that processes the form's data which we have supplied. The data is processed by various commands that we defined in the FDML document, which will take the data and create new HTML documents as well as updating existing HTML documents. What we end up with is an easy way to update our dynamic ad management system.

When performing your first update keep a close eye on how things are working. Check whether or not the views and click-thrus display page got all the updates, and whether the redirect page was created properly and in the right place. If you do run into trouble, double check that your field names from the form match the ones used in the FDML document, and check to ensure that all your <REPLACE> tags are closed correctly.

Consider Your Site

Now we are finished. When someone visiting your site sees an ad and clicks on it, the ad now records the view and the click, and keeps a running total of views and clicks that have happened on a protected page that you and select others have access to. Your Web site is now accuratley tracking advertising statistics in a professional manner.

With a lot of Web sites today, revenue is generated solely by advertising on the site. Being able to manage the ads on your Web site quickly and efficiently is an absolute necessity. Using the example in this article will provide you with a good start for managing your ads in this way. Consider adding an ad management system to your Web site because it can only benefit. The ad management system helps by automatically and dynamically displaying views, click-thrus, and the various advertisers on the site, and by saving the Webmaster large amounts of time in generating and distributing reports on ad statistics. When considering an ad management system for your site, do the pre-planning involved and think your decisions through logically. In the end, it will help you in the building process.

Quick and Dirty Click-Thru Counters

The system described in this article is full-featured and quite complete, but may be more than you need. If you've just got a few links that you would like to track click-thrus on, whether they are ad banners or simple text links to other Web sites, a simple, dynamic counter system can be created.

The trick to simplifying the system is to create a single redirect file that will handle all of your link counters. In the root folder of your Web server, create a file called "ClickThru.html" that looks exactly like this:

Redirect file

<INSERT_COUNT* <INSERT_PATH>>
<REDIRECT <INSERT_SEARCH>>

This file is a more generic version of the redirect file described in the full article, and performs the same function. In this case, however, we will use "path" and "search" fields to specify the name of the click-thru counter and the ultimate destination.


Kelly Konechny kkonechny@fbc.unitedgrain.ca is the Publishing Systems Coordinator for Farm Business Communications; he spends his time maintaining www.agcanada.com

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »

Price Scanner via MacPrices.net

13-inch M2 MacBook Airs in stock today at App...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more
Sunday Sale: Apple iPad Magic Keyboards for 1...
Walmart has Apple Magic Keyboards for 12.9″ iPad Pros, in Black, on sale for $150 off MSRP on their online store. Sale price for online orders only, in-store price may vary. Order online and choose... Read more

Jobs Board

Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.