Go Back   WarriorForum - Internet Marketing Forums > The Warrior Forum > Adsense / PPC / SEO Discussion Forum
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 06-02-2011, 08:46 AM   #1
Active Warrior
 
Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
Social Networking View Member's Twitter Profile 
Lightbulb For Google Adsense Publishers : Random Ads Position Script

Dear warrior and Google Adsense publishers,
I would like to share this simple script. With this script you can show up your Google Adsense ads or any other ads randomly : float left or float right around the article..

Hope this will be useful..
Google Adsense Random Ads Position or Placement Code :
Code:
<SCRIPT type="text/javascript">
// begin BloggerCeria GA Trik
var jumlah_iklan = 2;
var waktu_sekarang = new Date()
var detik = waktu_sekarang.getSeconds()
var pasang_iklan = detik % jumlah_iklan;
pasang_iklan +=1;
if (pasang_iklan==1) {
alg="float: left; margin-left: 3px; margin-right: 5px;";
}
if (pasang_iklan==2) {
alg="float: right; margin-left: 5px; margin-right: 3px;";
}
document.write('<div style=\"' + alg + '\">');
// End -->
</SCRIPT>

INSERT YOUR GOOGLE ADSENSE CODE OR OTHER ADS SCRIPT HERE

<SCRIPT type="text/javascript">
document.write('</div>');
</SCRIPT>
You can modify the code in blue color to fit your template.. If you are using Wordpress, then insert the code above on the single.php file. I don't know if the code is allowed by Adsense TOS, use at your own risk..

Some screenshot :


Refresh (F5) the page, the ads will be move the the left..



If I did something wrong or open this thread at the wrong place please forgive me. Just want to share. Thanks!
PHDLover is offline   Reply With Quote
Old 06-02-2011, 10:14 AM   #2
Active Warrior
 
Join Date: Apr 2011
Posts: 30
Thanks: 1
Thanked 6 Times in 6 Posts
Social Networking View Member's FaceBook Profile 
Default Re: For Google Adsense Publishers : Random Ads Position Script

A much easier way is just to wrap your adsense code in a div like so:

Code:
<div style="float: right; margin:10px;">
your adsense code
</div>

jefkas is offline   Reply With Quote
Old 06-03-2011, 05:06 AM   #3
Active Warrior
 
Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
Social Networking View Member's Twitter Profile 
Default Re: For Google Adsense Publishers : Random Ads Position Script

hi jefkas, yes you can use the div like the one you quote.
but my script will place the ads randomly everytime visitor open a post or article, floating left or floating right.. see the screenshot..
PHDLover is offline   Reply With Quote
Old 06-17-2011, 10:30 AM   #4
Active Warrior
 
Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
Social Networking View Member's Twitter Profile 
Default Re: For Google Adsense Publishers : Random Ads Position Script

an update for this script..
you can also replace this code
Code:
if (pasang_iklan==1) {
alg="float: left; margin-left: 3px; margin-right: 5px;";
}
if (pasang_iklan==2) {
alg="float: right; margin-left: 5px; margin-right: 3px;";
}
document.write('<div style="' + alg + '">');
with
Code:
if (pasang_iklan==1) {
stl="adsstyle1";
}
if (pasang_iklan==2) {
stl="adsstyle2";
}
document.write('<div class="' + stl + '">');
then add this into your css file

Code:
.adsstyle1 { ANYTHING }
.adsstyle2 { ANYTHING }
replace ANYTHING with, well, anything.. such as float right, float left or float center..
PHDLover is offline   Reply With Quote
Old 06-17-2011, 10:49 AM   #5
SEO Strategist
War Room Member
 
yukon's Avatar
 
Join Date: Jun 2010
Posts: 6,532
Thanks: 355
Thanked 1,992 Times in 1,273 Posts
Default Re: For Google Adsense Publishers : Random Ads Position Script

It would be a way better idea to rotate Adsense Ads server side with php. That way your page html source code wouldn't show any extra javascript.

Php would only show the exact copy & paste Adsense code from your Adsense Admin in the html source code, If Google ever had a look.

Every bit of that javascript will show up in your html source code.

Just saying...

yukon is offline   Reply With Quote
Old 06-17-2011, 11:44 AM   #6
Plundering the Web
War Room Member
 
paulgl's Avatar
 
Join Date: Feb 2007
Location: , , .
Posts: 4,851
Thanks: 804
Thanked 1,200 Times in 887 Posts
Default Re: For Google Adsense Publishers : Random Ads Position Script

Wouldn't calling the script from another page work as well, as
far as hiding the code?

Just put the code on a separate page by itself, then call it.

<script type="text/javascript" src="http://where-ever-the-code-is.js">
</script>

If you are just shifting it left, right, I probably would want it
in a set position myself.

Of course, one could write a little script that changes the word
left to right at random, then no need for the external javascript.

Paul

How to Make Money off Facebook: Login to your account. Deactivate your account. Get your butt to work.
paulgl is online now   Reply With Quote
Old 06-22-2011, 05:59 AM   #7
Active Warrior
 
Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
Social Networking View Member's Twitter Profile 
Default Re: For Google Adsense Publishers : Random Ads Position Script

Quote:
Originally Posted by yukon View Post
It would be a way better idea to rotate Adsense Ads server side with php. That way your page html source code wouldn't show any extra javascript.

Php would only show the exact copy & paste Adsense code from your Adsense Admin in the html source code, If Google ever had a look.

Every bit of that javascript will show up in your html source code.

Just saying...
you are very right! thanks sir..


Quote:
Originally Posted by paulgl View Post
Wouldn't calling the script from another page work as well, as
far as hiding the code?

Just put the code on a separate page by itself, then call it.

<script type="text/javascript" src="http://where-ever-the-code-is.js">
</script>

If you are just shifting it left, right, I probably would want it
in a set position myself.

Of course, one could write a little script that changes the word
left to right at random, then no need for the external javascript.

Paul
yup, but I'll stick to Yukon advice..
PHDLover is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > The Warrior Forum > Adsense / PPC / SEO Discussion Forum

Tags
ads, adsense, adsense tips, adsense trick, google, google adsense, position, publishers, random, random ads script, script

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 09:11 AM.