TGPX has a built in feature that will allow you to manage advertisements that can be displayed on your TGP pages. This document will give an overview of how to add, update, and delete advertisements through the control panel interface.
The ad.php script
The ad.php script can be used if you want to track the clicks that your advertisements receive. The first thing you need to do is edit the ad.php script to setup it's variables. Open the ad.php file in a text editor (EditPlus is recommended for Windows users) and locate the $USERNAME variable at the top of the file. You will see something similar to the following:
Searching Advertisements
To search the current advertisements you have configured so you can modify or delete them, access the Settings > Manage Advertisements function from the control panel menu. This will display a page where you will be able to see and search the current advertisements you have configured. All of the database fields that you can search use the software's Standard Search function with the exception of the Tags field which uses the Boolean Search feature. In the table that displays the advertisements, you will find a couple of functions that you can run on a single advertisement at a time. Those functions are described below.
Click this icon to edit the advertisement. A window will appear where you will be able to edit all of the advertisement settings. | |
Click this icon to delete this advertisement. |
Adding an Advertisement
To add a new advertisement, access the Settings > Manage Advertisements function from the control panel menu. Near the top of the page in the header bar that reads "Manage Advertisements" click on the icon. This will display a popup window where you will be able to enter the advertisement information that you want to use. Each of the form fields are described below.
Weight | The weight value to assign to this advertisement. The weight value can be any whole number from -2147483648 to 2147483647. Ad weight values only come into play if you are using the weight attribute of the {ad} template function OR the weight sorting option in the order setting of the {ad} template function. |
Raw Clicks | This is the number of raw clicks that the advertisement has received. You will generally want to set this to 0 when you are adding a new advertisement. |
Unique Clicks | This is the number of unique clicks that the advertisement has received. You will generally want to set this to 0 when you are adding a new advertisement. |
Tags | A space separated list of tags for this advertisement. Tags can be used in the {ad} template function to control which advertisements are selected for display. |
Categories | The categories that the advertisment fits into. Multiple categories can be selected by clicking the icon. You can remove categories by clicking on the icon. |
Ad URL | Enter the full URL to which this advertisment will be linking |
Ad HTML |
Enter the complete HTML code for this advertisement. Note that if you reference image files in this HTML code, the images will already need
to exist on your server. Use a full HTTP URL for your images to make sure they display correctly on all pages.
Template Values The Ad HTML has a few template values that you can use:
{$ad.ad_url} - The Ad URL that you entered for this advertisement {$config.install_url} - TGPX installation URL {$config.preview_url} - The thumbnail URL setting {$config.from_email} - E-mail Address setting {$config.from_email_name} - E-mail Name setting {$config.date_format} - Date Format setting {$config.time_format} - Time Format setting {$config.timezone} - Timezone setting {$config.dec_point} - Decimal Point setting {$config.thousands_sep} - Thousands Separator setting |
Advertisement Click Tracking
To have the clicks on your advertisements tracked by TGPX, it is necessary to do a bit of customization to your advertisement HTML code. You should also make sure that the ad.php script has been configured as described at the top of this document.
For an example, assume you have the following HTML code that you want to use for one of your advertisements:
<a href="http://www.jmbsoft.com/r/username/"> <img src="/images/affiliate-banner-general.png" border="0"><br /> Our site uses scripts from JMB Software! </a>As you can see, the code simply links directly to http://www.jmbsoft.com/r/username/ which will not track the clicks. You will need to replace that URL with a link to the ad.php script (the script that will track the clicks on your advertisements). The basic format that the ad.php script expects to be called as is:
<a href="{$config.install_url}/ad.php?id={$ad.ad_id|urlencode}&u={$ad.ad_url|urlencode}">
<img src="/images/affiliate-banner-general.png" border="0"><br />
Our site uses scripts from JMB Software!
</a>
Note that the only thing changed in the HTML code is the link. Instead of linking directly to the site, the link now goes through the ad.php script
and passes it both the Ad ID and the Ad URL so it can track the click and forward the surfer to the correct site.
Editing an Advertisement
To edit an advertisement you will first need to locate it through the Manage Advertisements interface. When you locate the advertisement you want to edit, click on the icon to bring up the advertisement editing interface. This interface is nearly identical to the advertisement creation interface, and has the same form fields with the same properties. You can make the changes that you want, and then press the Update Advertisement button to save your changes.
Deleting an Advertisement
To delete an advertisement you will first need to locate it through the Manage advertisements interface. When you locate the advertisement you want to delete, click on the icon, which will ask you to confirm the deletion.
Displaying Advertisments on Your TGP Pages
To display the advertisements you have configured through the control panel interface, you will use the {ad} template function. This template function (as well as all of the other template functions) is described in detail in the TGP Page Templates section of this manual.