代码之家  ›  专栏  ›  技术社区  ›  Mian Rizwan

仅显示谷歌AdSense广告推特访客

  •  0
  • Mian Rizwan  · 技术社区  · 8 年前

    我只想在访客来自推特时显示我的谷歌Adsense广告。目前我正在使用这段代码,这对Facebook和其他网站有效,但对Twitter无效

        <?php
                $ref = $_SERVER['HTTP_REFERER'];
                if (strpos($ref, 'twitter.com') != false) {?>
     <script type="text/javascript"><!--
        google_ad_client = "xx-xx-xxxxxxxxxxxxxxxxxx";
        /* xxxxxxxx xxxxxx xxx xxx xxx xx xxxxxx */
        google_ad_slot = "xxxxxxxxxxxxxx";
        google_ad_width = xxx;
        google_ad_height = xxx;
        //-->
        </script>
        <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
    </div>
    </div>
    
    <?php }else{
      echo "";  }
      ?>
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   Posttwo    8 年前

    推特通过重定向链接 https://t.co

    推荐文章