zoukankan      html  css  js  c++  java
  • 解决google 广告加载 慢 的问题

    <!--  google广告代码加载-->
    <script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"></script>
    <script type="text/javascript">
    GS_googleAddAdSenseService("ca-pub-3437941256594093");
    GS_googleEnableAllServices();
    </script>
    <script type="text/javascript">
    GA_googleAddSlot("ca-pub-3437941256594093", "anjuke_shanghai_homepage_bottom_728x90");
    GA_googleAddSlot("ca-pub-3437941256594093", "anjuke_shanghai_homepage_right_200x200");
    </script>
    <script type="text/javascript">
    GA_googleFetchAds();
    </script>



    <!-- google广告位置填充 -->
    <div id="anjuke_shanghai_homepage_bottom" style="display: none;">
    <script type="text/javascript">
    if($('adanjuke_zoneid_1002')){
    GA_googleFillSlot("anjuke_shanghai_homepage_bottom_728x90");
    }
    </script>
    </div>
    <!-- google广告位置填充 -->
    <div id="anjuke_shanghai_homepage_right" style="display: none;">
    <script type="text/javascript">
    if($('adanjuke_zoneid_1003')){
    GA_googleFillSlot("anjuke_shanghai_homepage_right_200x200");
    }
    </script>
    </div>

    <!-- 广告的迁移-->
    <script type="text/javascript">

    var get = function(id) {
    return document.getElementById(id);
    }

    var moved_ads = ['cproIframe1','cproIframe2','cproIframe3'];
    var moved_num = 0;
    var anjuke_ad_move = function(type,slot,target,id) {
    if(type == 'google'){
    var adslot = get(target), ifrm, ad_frame = get('google_ads_iframe_' + slot);
    }else if(type == 'baidu'){
    var adslot = get(slot), ifrm, ad_frame = get('baidu_clb_slot_iframe_' + id);
    }else{
    return;
    }

    if (adslot == null){
    return;
    }

    if(type == 'baidu' && ad_frame == null){
    var ad_id = moved_ads[moved_num];
    ad_frame = get(ad_id);
    if(ad_frame){
    moved_num++;
    }
    }

    if (ad_frame) {
    ifrm = document.createElement('iframe');
    ifrm.setAttribute('id', type+'_ads_slot_iframe_' + slot);
    ifrm.setAttribute('frameBorder', 0);
    ifrm.setAttribute('scrolling', 'no');
    ifrm.setAttribute('width', ad_frame.getAttribute('width'));
    ifrm.setAttribute('height', ad_frame.getAttribute('height'));
    adslot.appendChild (ifrm);
    if(ad_frame.src && ad_frame.src.indexOf('http') != -1){
    ifrm.src = ad_frame.src;
    }else{
    ifrm.contentWindow.document.open();
    ifrm.contentWindow.document.write(ad_frame.contentWindow.document.documentElement.innerHTML);
    ifrm.contentWindow.document.close();
    }

    } else {
    if(type == 'google'){
    var ad_div = get('google_ads_div_' + slot) || get('google_ads_div_' + slot + '_ad_container');
    }else{
    var ad_div = get(target);
    ad_div.style.display = "block";
    }

    if (ad_div) {
    adslot.innerHTML = ad_div.innerHTML;
    }
    }

    adslot.style.display = '';
    }

    setTimeout("anjuke_ad_move('google','anjuke_shanghai_homepage_bottom_728x90','adanjuke_zoneid_1002')", 0);
    setTimeout("anjuke_ad_move('google','anjuke_shanghai_homepage_right_200x200','adanjuke_zoneid_1003')", 100);
    </script>


    <script>
  • 相关阅读:
    python第四十二天 socket ---ssh
    python第四十一天---作业:简单FTP
    python第三十七天--异常--socket
    python第三十六天-----类中的特殊成员方法
    python第三十五天-----作业完成--学校选课系统
    python第三十三天----静态方法、类方法、属性方法
    RESTful Web Services初探
    OLAT & OLTP
    Solr4.8.0源码分析(7)之Solr SPI
    Solr4.8.0源码分析(6)之非排序查询
  • 原文地址:https://www.cnblogs.com/jonhson/p/2226945.html
Copyright © 2011-2022 走看看