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

Fallout Shelter pulls in ten times its u...
When the Fallout TV series was announced I, like I assume many others, assumed it was going to be an utter pile of garbage. Well, as we now know that couldn't be further from the truth. It was a smash hit, and this success has of course given the... | Read more »
Recruit two powerful-sounding students t...
I am a fan of anime, and I hear about a lot that comes through, but one that escaped my attention until now is A Certain Scientific Railgun T, and that name is very enticing. If it's new to you too, then players of Blue Archive can get a hands-on... | Read more »
Top Hat Studios unveils a new gameplay t...
There are a lot of big games coming that you might be excited about, but one of those I am most interested in is Athenian Rhapsody because it looks delightfully silly. The developers behind this project, the rather fancy-sounding Top Hat Studios,... | Read more »
Bound through time on the hunt for sneak...
Have you ever sat down and wondered what would happen if Dr Who and Sherlock Holmes went on an adventure? Well, besides probably being the best mash-up of English fiction, you'd get the Hidden Through Time series, and now Rogueside has announced... | Read more »
The secrets of Penacony might soon come...
Version 2.2 of Honkai: Star Rail is on the horizon and brings the culmination of the Penacony adventure after quite the escalation in the latest story quests. To help you through this new expansion is the introduction of two powerful new... | Read more »
The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
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 »

Price Scanner via MacPrices.net

Verizon has Apple AirPods on sale this weeken...
Verizon has Apple AirPods on sale for up to 31% off MSRP on their online store this weekend. Their prices are the lowest price available for AirPods from any Apple retailer. Verizon service is not... Read more
Apple has 15-inch M2 MacBook Airs available s...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs available starting at $1019 and ranging up to $300 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at Apple.... Read more
May 2024 Apple Education discounts on MacBook...
If you’re a student, teacher, or staff member at any educational institution, you can use your .edu email address when ordering at Apple Education to take up to $300 off the purchase of a new MacBook... Read more
Clearance 16-inch M2 Pro MacBook Pros in stoc...
Apple has clearance 16″ M2 Pro MacBook Pros available in their Certified Refurbished store starting at $2049 and ranging up to $450 off original MSRP. Each model features a new outer case, shipping... Read more
Save $300 at Apple on 14-inch M3 MacBook Pros...
Apple has 14″ M3 MacBook Pros with 16GB of RAM, Certified Refurbished, available for $270-$300 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year warranty is... Read more
Apple continues to offer 14-inch M3 MacBook P...
Apple has 14″ M3 MacBook Pros, Certified Refurbished, available starting at only $1359 and ranging up to $270 off MSRP. Each model features a new outer case, shipping is free, and an Apple 1-year... Read more
Apple AirPods Pro with USB-C return to all-ti...
Amazon has Apple’s AirPods Pro with USB-C in stock and on sale for $179.99 including free shipping. Their price is $70 (28%) off MSRP, and it’s currently the lowest price available for new AirPods... Read more
Apple Magic Keyboards for iPads are on sale f...
Amazon has Apple Magic Keyboards for iPads on sale today for up to $70 off MSRP, shipping included: – Magic Keyboard for 10th-generation Apple iPad: $199, save $50 – Magic Keyboard for 11″ iPad Pro/... Read more
Apple’s 13-inch M2 MacBook Airs return to rec...
Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices currently... Read more
Best Buy is clearing out iPad Airs for up to...
In advance of next week’s probably release of new and updated iPad Airs, Best Buy has 10.9″ M1 WiFi iPad Airs on record-low sale prices for up to $200 off Apple’s MSRP, starting at $399. Sale prices... Read more

Jobs Board

Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part Read more
*Apple* App Developer - Datrose (United Stat...
…year experiencein programming and have computer knowledge with SWIFT. Job Responsibilites: Apple App Developer is expected to support essential tasks for the RxASL 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.