![]() | | ||||||||
| | #1 |
| Active Warrior Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
|
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> ![]() 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! |
| | |
| | #2 |
| Active Warrior Join Date: Apr 2011
Posts: 30
Thanks: 1
Thanked 6 Times in 6 Posts
|
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> |
| | |
| | |
| | #3 |
| Active Warrior Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
|
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.. |
| | |
| | #4 |
| Active Warrior Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
|
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 + '">'); Code: if (pasang_iklan==1) {
stl="adsstyle1";
}
if (pasang_iklan==2) {
stl="adsstyle2";
}
document.write('<div class="' + stl + '">'); Code: .adsstyle1 { ANYTHING }
.adsstyle2 { ANYTHING } |
| | |
| | #5 |
| SEO Strategist War Room Member Join Date: Jun 2010
Posts: 6,532
Thanks: 355
Thanked 1,992 Times in 1,273 Posts
|
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... |
| | |
| | |
| | #6 |
| Plundering the Web War Room Member Join Date: Feb 2007 Location: , , .
Posts: 4,851
Thanks: 804
Thanked 1,200 Times in 887 Posts
|
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.
| |
| | |
| | #7 | ||
| Active Warrior Join Date: Apr 2011
Posts: 40
Thanks: 6
Thanked 10 Times in 10 Posts
| Quote:
![]() Quote:
| ||
| | |
![]() |
|
| Tags |
| ads, adsense, adsense tips, adsense trick, google, google adsense, position, publishers, random, random ads script, script |
| Thread Tools | |
| |
![]() |