sojic
-
Posts
5 -
Joined
-
Last visited
Posts posted by sojic
-
-
I have ajax loading page, and need to "refresh" the banners after ajax loading, and find the following, I can say, working, solution:
I'm not expert in JS, but I use very simple method, even without jquery. And it work fine for text, html, and other ad system code banners.
in the real slot I put only div:
<div id="OA_show_7"></div>
then single load config
<script type='text/javascript'><!--// <![CDATA[var OA_zones = {'my_zone_name' : 7}// ]]> --></script>at the bottom of pages, avoid delay main content rendering
//initial request:
<script type='text/javascript' src='http://AD.SERVER>NAME/id=1&charset=UTF-8'></script>
//insert banner code in hidden div
<div id="OA_container_zone_7" style="display:none;"><script type='text/javascript'>OA_show('my_zone_name');</script></div>//copy rendered code to real, visible slot<script language="JavaScript">function g_e(el) {return document.getElementById(el);}if (g_e('OA_show_7')) g_e('OA_show_7').innerHTML=g_e('OA_container_zone_7').innerHTML;</script>But...
Placing banners in "hidden" div is agains google adsense terms and conditions.
Here is my "improvement", but it require change in spcjs.php
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title> </title> <script type='text/javascript'> var OA_zones = { 'header': 3, 'sidebar': 8, 'eventSidebar': 9, } </script> <script type='text/javascript' src='http://DOMAIN/www/delivery/spcjs1.php'></script> </head> <body> <div class="revive" data-reviveSlot="header"></div> Lorem ipsum Bla bla <div class="revive" data-reviveSlot="sidebar"></div> Lorem ipsum Bla bla <div class="revive" data-reviveSlot="sidebar"></div> Lorem ipsum Bla bla <div class="revive" data-reviveSlot="eventSidebar"></div> <button>refresh</button> <!-- Javascript below this line --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript"> $('button').click(function() { $('.revive').each(function(i, element) { var id = $(element).attr('data-reviveSlot'); $(element).html(OA_show(id)); }) return false; }) </script> </body> </html>
Change in spcjs.php is in OA_show function (line 3199 in v3.2.1)
replace document.write({$varprefix}output[name]);
with return {$varprefix}output[name]
-
Not working!
-
Hi to everybody.
I'm new here.
I did not find how to:
I want to create campaing "Google Adsense" and limit it to example: 2 clicks in 2 days.... so if somebody click 2 google adsense ads, to switch to another ad network. After 2 days to reset it and display again Google adsense.
Any hints how to achieve this?
-
@Richard Foley, I need similar functionality (I'm loading content via ajax) and I want to refresh the "header" (which is not reloaded).
Can you provide code example? How to trigger new "zone redraw".
Asynchronous Loading
in For Developers
Posted
I have problems with refreshing google adsense… The sciprt I have provided is working pretty good… but.. after several refreshes, ad slots are empty.
Anybody interested to work around, here is demo: http://cdn.amazingradios.com/res/test.html after 4-5 refreshes, I guess google serve empty ads.