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

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
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
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and 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.