Code supplied by TheNetHustle.com
===================
$offer = '';
$offerURLs = array();
// split-test the following offers; track via tid
// add as many offers here as you'd like here
// be sure to increment array element
$offerURLs[0] = 'http://YOURNICK.CBOFFER1.hop.clickbank.net/';
$offerURLs[1] = 'http://YOURNICK.CBOFFER2.hop.clickbank.net/';
$offerURLs[2] = 'http://YOURNICK.CBOFFER3.hop.clickbank.net/';
// if the user has already been presented an offer, make sure they
// see the same one if they refresh or re-visit your domain
if(isset($_COOKIE['offer'])) {
$offer = $_COOKIE['offer'];
} else {
// else pick a random offer from the split-test offers array above
$offer = rand(0,sizeof($offerURLs) - 1);
}
// set a cookie whatever offer was chosen in case they refresh/revisit...
// cookie set to expire after 30 days
setcookie('offer', $offer, time()+60*60*24*30, '/', '.yourdomain.com');
// build offer URL; will generate a ClickBank tid
// "something_meaningful_to_you" + "the offer# that the user converts through"
// e.g. if I set this up on 2-3 domains I will replace "something_meaningful_to_you"
// with something that tells me which domain the click came through
$offerURL = $offerURLs[$offer].'&tid=something_meaningful_to_you'.$offer;
?>
<html><head><title>Loading…</title></head><body>
<!– insert Google Analytics code here –>
<script language="javascript" type="text/javascript">window.location.href='<?= $offerURL ?>';</script>
</body></html>
==========================
taken from:
http://thenethustle.com/internet-marketing/clickbank-redirect-offer-rotator-with-google-analytics