Category: EL Adsense

  • How to Refresh Ad Slots Automatically?

    www.laborblog.my.id - There are multiple ways to refresh ad slots using GPT library function. But none of the documents or examples provided for auto refreshing ad slots based on Time event.

    illustration | pragmaticwebmedia.com
    – There are multiple ways to refresh ad slots using GPT library function. But none of the documents or examples provided for auto refreshing ad slots based on Time event.


    How to do?
    Declare variable name globally before ‘cmd.push’ function and assign to the ad slot declaration. Example see below
    var slot1;
    Assign variable to the ad slot.
    Add that variable before the ad slot in the header tag.
    slot1 = googletag.defineSlot(‘/200894144/Responsive’, [[300, 250], [300, 600]], ‘div-gpt-ad-1620832289302-0’).addService(googletag.pubads());
    Auto Refresh Trigger
    The final step is to trigger auto refresh using ‘SetInterval’ function on the Body code. This will trigger the refresh code on specified interval.
    setInterval(function(){googletag.pubads().refresh([slot1]);}, 3000);
    The variable which declared on the first step to be added within the refresh function on the above code. “3000” represent three second time interval . Time cab be adjusted based on your requirement. Best practices is minimum 30 seconds.
    Complete Code Configuration
    Here is the full code representation for the above discussions. Added key values for the test purposed. Ignore that in your code and replace as per your requirements.

    <script async src=”https://securepubads.g.doubleclick.net/tag/js/gpt.js”></script>
    <script>
    window.googletag = window.googletag || {cmd: []};
    var slot1;
    googletag.cmd.push(function() {
    slot1 = googletag.defineSlot(‘/200894144/Responsive’, [[300, 250], [300, 600]], ‘div-gpt-ad-1620832289302-0’).setTargeting(“Test_Mode”, “ON”).addService(googletag.pubads());
    googletag.enableServices();
    });
    </script>
    <div id=’div-gpt-ad-1620832289302-0′>
    <script>
    googletag.cmd.push(function() { googletag.display(‘div-gpt-ad-1620832289302-0’);
    setInterval(function(){googletag.pubads().refresh([slot1]);}, 3000);
    });
    </script>
    </div>


    Hope this article helps!!!. Please share your comments. Thank You!!!![source]
    *The information contained in this post is for general information purposes only. The information is provided by How to auto refresh ad slots? and while we endeavor to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the post for any purpose.
  • How to Make Responsive Floating Adsense Ads under the Blog

    www.laborblog.my.id - On this occasion laborblog.my.id will try to give tips on how to make floating ads easily. If you want to place floating ads, you have to be careful, don't let these ads disturb your blog visitors.

    Screenshot
    On this occasion laborblog.my.id will try to give tips on how to make floating ads easily. If you want to place floating ads, you have to be careful, don’t let these ads disturb your blog visitors.


    Sticky fixed ads placed at the bottom of the screen have a pretty solid click-through rate. Because of its performance, blog visitors will continue to see ads even if the article is scrolled down or up. , it will have a higher clickthrough potential (CTR). So how do you make a floating ad? Let’s see the tips below.
    Easy Ways to Make Floating Adsense Ads
    1. Open Blogger and Theme
    The first thing to do is go to blogger.com, then select a theme and edit the html code.
    Warning! : Before modifying the blog template, it is recommended to make a backup first, if there is an error it can be fixed immediately.
    2. Create Responsive Ads and Edit Code
    The second way, create a new ad in responsive format, then copy the adsense code into the text as marked below.

    <script type=’text/javascript’> $(document).ready(function() {$(&#39;img#closed&#39;).click(function(){$(&#39;#btm_banner&#39;).hide(90);});}); </script>
    <!–start: floating ads–>
    <div id=’floatads’ style=’width:100%;margin:auto; text-align:center;float:none;overflow:hidden; display:scroll;position:fixed; bottom:0;z-index:9999′>
    <div><a id=’close-floatads’ onclick=’document.getElementById(&apos;floatads&apos;).style.display = &apos;none&apos;;’ style=’cursor:pointer;’><img alt=’close’ src=’https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhclRDQZWqGVHmf1si9GTOlj-GAtAcNDA2TWpO4mrgttAwRDvOT74pcD_lBPspiNxF2SAO_EnysDgYmVA0EAVD4iR3yQ2AIstgUwROXMqEdoKhXk0fQhwWVmwhL2-JwQBjqzzdLNmqsK14/s1600/btn_close.gif’ title=’close button’/></a></div>
    <div style=’text-align:center;display:block;max-width:728px;height:auto;overflow:hidden;margin:auto’>
    <!–Script iklan–>
    [Masukaniklandisini]
    <!–Akhir script iklan–>
    </div>
    </div>
    <!–end: floating ads–>

    3. Put the above code above </body>
    When finished creating the script above, copy and paste it above the code </body>
    4. Save
    If the steps are done correctly, it will look like this .


    Accordingly the article “How to Make Responsive Floating Adsense Ads under the Blog” may be useful. If there is a tutorial that is not clear, you can leave a comment below. Happy reading and blogging