<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: How to Randomize AdSense Ads with Javascript</title>
	<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/</link>
	<description>Writing, Designing, and Making Money Online</description>
	<pubDate>Fri, 25 Jul 2008 12:36:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Walkere</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-1490</link>
		<dc:creator>Walkere</dc:creator>
		<pubDate>Sat, 12 Apr 2008 17:40:08 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-1490</guid>
		<description>So you want to show a different Ad Sense ad, depending on the situation?

For this, I would advise using PHP.  The Javascript alternative above is good for a simple random selection of ads, but it's not going to work as well when you have to interact with a database.

However, the same concept would apply.  First, you want to make a variable that tells the script what type of ad to display.

For example, if the admin is viewing the page, the variable is set to 1.  If the author is viewing the page, the variable is set to 2.

Then, use a &lt;a href="http://us2.php.net/switch" rel="nofollow"&gt;switch statement&lt;/a&gt; to echo the proper Ad Sense code.</description>
		<content:encoded><![CDATA[<p>So you want to show a different Ad Sense ad, depending on the situation?</p>
<p>For this, I would advise using PHP.  The Javascript alternative above is good for a simple random selection of ads, but it&#8217;s not going to work as well when you have to interact with a database.</p>
<p>However, the same concept would apply.  First, you want to make a variable that tells the script what type of ad to display.</p>
<p>For example, if the admin is viewing the page, the variable is set to 1.  If the author is viewing the page, the variable is set to 2.</p>
<p>Then, use a <a href="http://us2.php.net/switch" rel="nofollow">switch statement</a> to echo the proper Ad Sense code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shiv Majumdar</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-1489</link>
		<dc:creator>Shiv Majumdar</dc:creator>
		<pubDate>Sat, 12 Apr 2008 16:50:36 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-1489</guid>
		<description>I am a non-techie. i happened to land on this interesting page.

I am struggling to put together a rotator for three adsense codes on a wordpress article directory I am planning for a long time- admin, author and referer.

Obviously the last two have to be picked up from a database.

Any help possible?</description>
		<content:encoded><![CDATA[<p>I am a non-techie. i happened to land on this interesting page.</p>
<p>I am struggling to put together a rotator for three adsense codes on a wordpress article directory I am planning for a long time- admin, author and referer.</p>
<p>Obviously the last two have to be picked up from a database.</p>
<p>Any help possible?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Monkeygames.ws</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-774</link>
		<dc:creator>Monkeygames.ws</dc:creator>
		<pubDate>Wed, 19 Mar 2008 05:12:19 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-774</guid>
		<description>Your website is a great

thanks</description>
		<content:encoded><![CDATA[<p>Your website is a great</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Walkere</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-520</link>
		<dc:creator>Walkere</dc:creator>
		<pubDate>Wed, 05 Mar 2008 20:59:42 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-520</guid>
		<description>Sure.  To do that, you should save the Math.random() value in a variable (like var prob).  Then, include extra if/else statements and modify the percentages, kind of like this...

&lt;pre lang='javascript'&gt;var prob = Math.random();
if (prob &gt; 0.66) {
  //  First Ad Here
} else if (prob &gt; 0.33) {
  //  Second Ad Here
} else if (prob &gt; 0) {
  //  Third Ad Here
}&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Sure.  To do that, you should save the Math.random() value in a variable (like var prob).  Then, include extra if/else statements and modify the percentages, kind of like this&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> prob = Math.<span style="color: #006600;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>prob &gt; <span style="color: #CC0000;">0.66</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #009900; font-style: italic;">//  First Ad Here</span>
<span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>prob &gt; <span style="color: #CC0000;">0.33</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #009900; font-style: italic;">//  Second Ad Here</span>
<span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>prob &gt; <span style="color: #CC0000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #009900; font-style: italic;">//  Third Ad Here</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: A Tua Mae</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-511</link>
		<dc:creator>A Tua Mae</dc:creator>
		<pubDate>Wed, 05 Mar 2008 06:18:10 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-511</guid>
		<description>Greetings.

Is it possible to have more than 2 ads rotating?

Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Greetings.</p>
<p>Is it possible to have more than 2 ads rotating?</p>
<p>Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Walkere</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-431</link>
		<dc:creator>Walkere</dc:creator>
		<pubDate>Sun, 02 Mar 2008 19:16:24 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-431</guid>
		<description>The biggest reason you'd want to do it is to test out a new type of ad.

For example, let's say I wanted to see if text ads or an image ad worked better in my Skyscraper.  I'd go into AdSense, create two ad units, give each an individual channel, and then randomly select which to show.

After a week, I could compare which performed better and see which would earn me more money.  Likewise you could test different color schemes and themes.</description>
		<content:encoded><![CDATA[<p>The biggest reason you&#8217;d want to do it is to test out a new type of ad.</p>
<p>For example, let&#8217;s say I wanted to see if text ads or an image ad worked better in my Skyscraper.  I&#8217;d go into AdSense, create two ad units, give each an individual channel, and then randomly select which to show.</p>
<p>After a week, I could compare which performed better and see which would earn me more money.  Likewise you could test different color schemes and themes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sunjester</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-429</link>
		<dc:creator>sunjester</dc:creator>
		<pubDate>Sun, 02 Mar 2008 18:37:10 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-429</guid>
		<description>but why would you rotate page specific ads like adsense? they are contextual ads, they dont need to be rotated.</description>
		<content:encoded><![CDATA[<p>but why would you rotate page specific ads like adsense? they are contextual ads, they dont need to be rotated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buck</title>
		<link>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-414</link>
		<dc:creator>Buck</dc:creator>
		<pubDate>Sun, 02 Mar 2008 07:38:23 +0000</pubDate>
		<guid>http://www.earn-web-cash.com/2008/02/29/random-adsense-javascript/#comment-414</guid>
		<description>I've seen something similar for randomizing the ad colors. It makes them dynamic enough to stick out and be interesting.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve seen something similar for randomizing the ad colors. It makes them dynamic enough to stick out and be interesting.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
