Rotating ads

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Rotating ads

Harvey
Once you guys told me I could rotate ads by doing this:<br/><br/>

    <n.if.equal value1="[n.random max='2'/]" value2="1">  
        <then>
<a href="http://www.avantlink.com/click.php?tt=ml&amp;ti=60093&amp;pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a>
</then>  
        <else>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0156740191883467";
/* Leaderboard (Forum) */
google_ad_slot = "9529659947";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</else>  
    </n.if.equal>  

But it seems to show both ads.
What am I doing wrong?

How would I rotate three ads in various percentages?
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
Take a look at this code:
<n.comment.>Saving at the variable rand_num a random number between 0 and 100.</n.comment.>
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          
<n.comment.>Printing the random number. You can delete this line later.</n.comment.>
<n.var name='rand_num'/><br/>
<n.comment.>First check: the number has 25% to be between 0 and 25</n.comment.>
<n.comment.>Second check: the number has 40% to be between 25 and 65</n.comment.>
<n.comment.>Third check: the number has 35% to be between 65 and 100</n.comment.>
<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then>25%</then>
		<else.if.is_less_than i="65">
			<then>40%</then>
			<else>35%</else>
		</else.if.is_less_than>
	</n.if.is_less_than>                
</n.int.>
Read, try to understand and see it working at my forum header: http://pedro.2313024.n4.nabble.com/
I get a random number and show the probability of getting this number. Just math.
You can take this structure and use on your ads. Change the "i" attributes to set your intervals and the percentage as well.
Put the ad code inside "then" and "else" tags.
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
Pedro <Nabble> wrote
Take a look at this code:
<n.comment.>Saving at the variable rand_num a random number between 0 and 100.</n.comment.>
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          
<n.comment.>Printing the random number. You can delete this line later.</n.comment.>
<n.var name='rand_num'/><br/>
<n.comment.>First check: the number has 25% to be between 0 and 25</n.comment.>
<n.comment.>Second check: the number has 40% to be between 25 and 65</n.comment.>
<n.comment.>Third check: the number has 35% to be between 65 and 100</n.comment.>
<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then>25%</then>
		<else.if.is_less_than i="65">
			<then>40%</then>
			<else>35%</else>
		</else.if.is_less_than>
	</n.if.is_less_than>                
</n.int.>
Read, try to understand and see it working at my forum header: http://pedro.2313024.n4.nabble.com/
I get a random number and show the probability of getting this number. Just math.
You can take this structure and use on your ads. Change the "i" attributes to set your intervals and the percentage as well.
Put the ad code inside "then" and "else" tags.
I'm sorry Pedro I don't understand this. If you could show me how the final code would look I will try it.


HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          
<n.var name='rand_num'/>
<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then>CODE FOR AD #1 to be shown at 25%</then>
		<else.if.is_less_than i="65">
			<then>CODE FOR AD #2 to be shown at 40%</then>
			<else>CODE FOR AD #2 to be shown at 35%</else>
		</else.if.is_less_than>
	</n.if.is_less_than>  

Is this right?

And then a rotation of  TWO ads would be:

<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          
<n.var name='rand_num'/>
<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then>CODE FOR AD #1 to be shown at 25%</then>
			<else>CODE FOR AD #2 to be shown at 75%</else>
	</n.if.is_less_than>  

??
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
It must be something like this:
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          

<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then>CODE FOR AD #1 to be shown at 25%</then>
			<else>CODE FOR AD #2 to be shown at 75%</else>
	</n.if.is_less_than>  
</n.int.>
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
This code:

<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          

<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then><a href="http://www.avantlink.com/click.php?tt=ml&amp;ti=60093&amp;pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a></then></then>
			<else><script type="text/javascript"><!--
google_ad_client = "ca-pub-0156740191883467";
/* Leaderboard (Forum) */
google_ad_slot = "9529659947";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">


Seems to give me both ads at the same time.
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
This post was updated on .
This is not the structure I gave you. You have two closing "then" tags. No ending "else" nor ending "int".
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
This is hopefully closer to correct, but still not correct based on results.

<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          

<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then><a href="http://www.avantlink.com/click.php?tt=ml&amp;ti=60093&amp;pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a></then>
			<else>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0156740191883467";
/* Leaderboard (Forum) */
google_ad_slot = "9529659947";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</else>
</n.int>
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
Where are you using that?
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
Pedro <Nabble> wrote
Where are you using that?
Here:

http://forum.nyskiblog.com/Ad-Rotation-Test-v2-td4031630.html
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
But where is the code?
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
Here is the code:
<n.set_var. name='rand_num'><n.random max="100"/></n.set_var.>          

<n.int. i="[n.var name='rand_num'/]">                
	<n.if.is_less_than i="25">
		<then><a href="http://www.avantlink.com/click.php?tt=ml&amp;ti=60093&amp;pw=149617"><img src="http://www.avantlink.com/gbi/10065/60093/124793/149617/image.jpg" width="728" height="90" style="border: 0px;" alt="" /></a></then>
			<else>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-0156740191883467";
/* Leaderboard (Forum) */
google_ad_slot = "9529659947";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</else>
</n.int>
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
I mean, where in your forum you added this code?
My test forum.
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Harvey
Pedro <Nabble> wrote
I mean, where in your forum you added this code?

I pasted it in a post. I guess that is not a legitimate way to test it.

I was trying to avoid bringing the site down if I made an error.
HTTPS Please!
Reply | Threaded
Open this post in threaded view
|

Re: Rotating ads

Pedro
Naml is not readable inside posts.
My test forum.