Dave Tips

Tips for computers and the internet. How to, tips, tricks and resources for computers and the web.

Wednesday, March 28, 2007

AB split test in PHP

If you have a web site, and you run ads on it, you probably want to make the most money you can. This means testing out different sizes, layouts, colors, and even types of ad to see which ones make the most money. One of the easiest ways to find the most profitable ad, is to run a split test.

An AB split test runs one ad, the "A" ad, part of the time, and shows a second, the "B" ad, the other part of the time. After they've each been displayed many times, the results of the two different ads can be compared. Then, replace the less profitable ad with a new format/color/etc. and run the test again. This way you'll refine the ads over time, and always be lookng to improve your revenue.

If you host your site somewhere that supports PHP, you can set up an AB split test using this code:

<?php
if (rand(1, 100) > 50) { // display this 50% of the time
echo "A ad's code is here";
}
else { // display this the other 50% of the time
echo "B ad's code is here";
}
?>


You can change the code to display each ad whatever percentage of the time you choose. Just change the last number in this line:

if (rand(1, 100) > 50)

For example, using the number 80 (instead of 50) displays ad A %20 of the time, and the other 80% of the time, the B ad is displayed.

Note: If your ad code has a quote characters in it, you must escape them by putting a backslash \ before the quote character so php will not see them as the end of the echo string.

Labels: ,

Monday, March 12, 2007

How To Make Your .doc Into a .rtf

Converting a Microsoft Word Document file (.doc) to Rich Text Format file (.rtf) allows you to share it with other people while keeping your formating intact. You don't need to worry what version of which word processor they have because almost all word processors, and many other programs, can open, edit and resave RTF files. Unlike PDF's, one does not need another program to edit an RTF file and resave it.

Labels: , ,

Friday, March 2, 2007

Email Addresses on Your Website

This email encoder from Automatic Labs may keep robots from harvesting your email address and spamming you, while allowing any human visitors to email you.

Labels:

PHP Function Reference

The Invauluable resource for writing PHP web sites, it deals with all the syntax and other good stuff.

Labels: ,

VisiBone Webmaster's Color Lab

You can test out web-safe colors to develop a color scheme that will look the same on different browsers and platforms.

Labels: