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

Jump into one of Volkswagen's most...
We spoke about PUBG Mobile yesterday and their Esports development, so it is a little early to revisit them, but we have to because this is just too amusing. Someone needs to tell Krafton that PUBG Mobile is a massive title because out of all the... | Read more »
PUBG Mobile will be releasing more ways...
The emergence of Esports is perhaps one of the best things to happen in gaming. It shows our little hobby can be a serious thing, gets more people intrigued, and allows players to use their skills to earn money. And on that last point, PUBG Mobile... | Read more »
Genshin Impact 5.1 launches October 9th...
If you played version 5.0 of Genshin Impact, you would probably be a bit bummed by the lack of a Pyro version of the Traveller. Well, annoyingly HoYo has stopped short of officially announcing them in 5.1 outside a possible sighting in livestream... | Read more »
A Phoenix from the Ashes – The TouchArca...
Hello! We are still in a transitional phase of moving the podcast entirely to our Patreon, but in the meantime the only way we can get the show’s feed pushed out to where it needs to go is to post it to the website. However, the wheels are in motion... | Read more »
Race with the power of the gods as KartR...
I have mentioned it before, somewhere in the aether, but I love mythology. Primarily Norse, but I will take whatever you have. Recently KartRider Rush+ took on the Arthurian legends, a great piece of British mythology, and now they have moved on... | Read more »
Tackle some terrifying bosses in a new g...
Blue Archive has recently released its latest update, packed with quite an arsenal of content. Named Rowdy and Cheery, you will take part in an all-new game mode, recruit two new students, and follow the team's adventures in Hyakkiyako. [Read... | Read more »
Embrace a peaceful life in Middle-Earth...
The Lord of the Rings series shows us what happens to enterprising Hobbits such as Frodo, Bilbo, Sam, Merry and Pippin if they don’t stay in their lane and decide to leave the Shire. It looks bloody dangerous, which is why September 23rd is an... | Read more »
Athena Crisis launches on all platforms...
Athena Crisis is a game I have been following during its development, and not just because of its brilliant marketing genius of letting you play a level on the webpage. Well for me, and I assume many of you, the wait is over as Athena Crisis has... | Read more »
Victrix Pro BFG Tekken 8 Rage Art Editio...
For our last full controller review on TouchArcade, I’ve been using the Victrix Pro BFG Tekken 8 Rage Art Edition for PC and PlayStation across my Steam Deck, PS5, and PS4 Pro for over a month now. | Read more »
Matchday Champions celebrates early acce...
Since colossally shooting themselves in the foot with a bazooka and fumbling their deal with EA Sports, FIFA is no doubt scrambling for other games to plaster its name on to cover the financial blackhole they made themselves. Enter Matchday, with... | Read more »

Price Scanner via MacPrices.net

Apple Watch Ultra available today at Apple fo...
Apple has several Certified Refurbished Apple Watch Ultra models available in their online store for $589, or $210 off original MSRP. Each Watch includes Apple’s standard one-year warranty, a new... Read more
Amazon is offering coupons worth up to $109 o...
Amazon is offering clippable coupons worth up to $109 off MSRP on certain Silver and Blue M3-powered 24″ iMacs, each including free shipping. With the coupons, these iMacs are $150-$200 off Apple’s... Read more
Amazon is offering coupons to take up to $50...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for up to $110 off MSRP, each including free delivery. Prices are valid after free coupons available on each mini’s product page, detailed... Read more
Use your Education discount to take up to $10...
Need a new Apple iPad? 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 $100 off the... Read more
Apple has 15-inch M2 MacBook Airs available f...
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
Mac Studio with M2 Max CPU on sale for $1749,...
B&H Photo has the standard-configuration Mac Studio model with Apple’s M2 Max CPU in stock today and on sale for $250 off MSRP, now $1749 (12-Core CPU and 32GB RAM/512GB SSD). B&H offers... Read more
Save up to $260 on a 15-inch M3 MacBook Pro w...
Apple has Certified Refurbished 15″ M3 MacBook Airs in stock today starting at only $1099 and ranging up to $260 off MSRP. These are the cheapest M3-powered 15″ MacBook Airs for sale today at Apple.... Read more
Apple has 16-inch M3 Pro MacBook Pro in stock...
Apple has a full line of 16″ M3 Pro MacBook Pros available, Certified Refurbished, starting at $2119 and ranging up to $440 off MSRP. Each model features a new outer case, shipping is free, and an... Read more
Apple M2 Mac minis on sale for $120-$200 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $110-$200 off MSRP this weekend, each including free delivery: – Mac mini M2/256GB SSD: $469, save $130 – Mac mini M2/512GB SSD: $689.... Read more
Clearance 9th-generation iPads are in stock t...
Best Buy has Apple’s 9th generation 10.2″ WiFi iPads on clearance sale for starting at only $199 on their online store for a limited time. Sale prices for online orders only, in-store prices may vary... Read more

Jobs Board

Senior Mobile Engineer-Android/ *Apple* - Ge...
…Trust/Other Required:** NACI (T1) **Job Family:** Systems Engineering **Skills:** Apple Devices,Device Management,Mobile Device Management (MDM) **Experience:** 10 + Read more
Sonographer - *Apple* Hill Imaging Center -...
Sonographer - Apple Hill Imaging Center - Evenings Location: York Hospital, York, PA Schedule: Full Time Full Time (80 hrs/pay period) Evenings General Summary Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of 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
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
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.