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

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom 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.