Helping ordinary people create extraordinary websites!

Conduct Web experiments using PHP, Part 1

By Paul Meagher
2005-03-16

Understanding the demo
In the examples directory, you'll find a demo_2d.php script. To get this demo to work, set up the demo database and modify the config.php file to appropriate values. After you've done this, point your browser at the demo_2d.php script and you will see something similar to Figure 1:

Figure 1. Two-factor Web offer demo


Because $this->debug is, by default, set to true in the StimulusResponse.php class, you can see some of the experiment-related SQL statements issued prior to the generation of the page. As you click between the home, about, products, and profile links, you can see which SQL statements are used to obtain the stimulus codes and to track the number of exposures to the offer.

For your amusement, the content area of the page consists of the output of a UNIX Fortune call.

A surrogate for the actual ad banner is presented in the right-hand column in the form of a reference to the relevant image. When you test the demo, notice that the ad banner variant does not change for you unless you clear your cookies and happen to be assigned a different stimulus code.

You also can click on a link to add yourself to a mailing list. If you proceed with the demo by clicking this link you can submit your e-mail address using a dummy form that only records that the form was submitted. When you submit the form your response column is set to "y" in the WebOffer record next to the stimulus code replicate you were assigned. Also, the response timer is stopped by recording when your response occurred.



Tutorial pages:

First published by IBM developerWorks


 1 Votes

You might also want to check these out:


Leave a Comment on "Conduct Web experiments using PHP, Part 1"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS