通知

請務必前往您的 AdSense 頁面,查看帳戶的相關個人化資訊,運用 AdSense 順利達成目標。

廣告導入指南

更改 AdSense 廣告程式碼

AdSense 計劃政策不允許發佈商為了哄抬廣告成效或抑制廣告客戶的轉換,而對 AdSense 程式碼進行任何修改。發佈商帳戶本來就提供了產生廣告程式碼的許多方法,足夠建立適合網站的廣告版面配置,所以我們一般建議您直接複製並貼上廣告程式碼。但我們瞭解,為了打造清爽的瀏覽介面,有時後修改在所難免。

應避免使用的技巧

以下是幾項您應該避免使用的技巧:

  • 在任何情況下隱藏廣告單元 (例如使用 display:none),除非您想導入回應式廣告單元
  • AdSense 廣告程式碼的導入方式不當,導致廣告遮蓋內容,或內容遮蓋廣告
  • 在行動網站或採用回應式設計的網站上,廣告單元放置的方式導致內容和廣告重疊
  • 使用隱藏關鍵字、IFRAME 或任何其他方法來操控廣告的指定目標
  • 透過電子郵件或軟體來散佈廣告
  • 操控廣告的放送和顯示以吸引不必要的注意 (例如廣告滑動入畫面,廣告放大/縮小)。
  • 當使用者在行動網頁上進行拖曳動作時觸發廣告點擊。

允許的修改方式

以下是幾項允許的修改方式:

回應式設計

新版非同步廣告程式碼可以讓您透過 CSS 和媒體查詢 (選用) 來設定廣告大小,以符合回應式網站的設計。進一步瞭解如何使用回應式廣告單元

A/B 測試

您可以藉由 AdSense 實驗,比較在廣告單元中使用不同的廣告類型和/或文字廣告樣式設定時,成效有何差異。實驗可以協助您更明智地判斷設定廣告單元的方法,進而提高收益。進一步瞭解實驗

如果您需要更精細地控制 A/B 測試,請參閱下列程式碼片段:

  • 同步廣告程式碼
    <script type="text/javascript">
        var random_number = Math.random();
        google_ad_client = "ca-publisher-id";
        google_ad_width = 728;
        google_ad_height = 90;

        if (random_number < .5){
            google_ad_slot = "1234567890";
        } else {
            google_ad_slot = "2345678901";
        }

    </script>
    <script type="text/javascript"
        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
  • 非同步廣告程式碼
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-publisher-id" crossorigin="anonymous"></script>
    <ins class="adsbygoogle"
        style="display:inline-block;width:728px;height:90px"
        data-ad-client="ca-publisher-id">
    </ins>
    <script>
        if (Math.random() < .5) {
          mySlotId = '1234567890';
        } else {
          mySlotId = '2345678901';
        }
        (adsbygoogle = window.adsbygoogle || []).push({
          params: { google_ad_slot: mySlotId }
        });
    </script>
以動態方式設定自訂管道
  • 同步廣告程式碼
    <script type="text/javascript">
        var channel_condition = object.booleanMethod();
        google_ad_client = "ca-publisher-id";
        google_ad_slot = "1234567890";
        google_ad_width = 728;
        google_ad_height = 90;
        if (channel_condition){
            google_ad_channel = "123457789";
        } else {
            google_ad_channel = "263477489";
        }

    </script>
    <script type="text/javascript"
        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
  • 非同步廣告程式碼
    <script async src="http://pagead2.googlesyndication.com/pagead/adsbygoogle.js?client=ca-publisher-id" crossorigin="anonymous">
    <ins class="adsbygoogle"
        style="display:inline-block;width:728px;height:90px"
        data-ad-client="ca-publisher-id"
        data-ad-slot="1234567890">
    </ins>
    <script>
        channel_condition = object.booleanMethod();
        if (channel_condition) {
          my_google_ad_channel = '123457789';
        }
        else {
          my_google_ad_channel = '263477489';
        }
        (adsbygoogle = window.adsbygoogle || []).push({
          params: { google_ad_channel: my_google_ad_channel}
        });
    </script>
減少廣告代碼
  • 同步廣告程式碼
    <script type="text/javascript">
        google_ad_client = "ca-publisher-id";
        google_ad_slot = "1234567890";
        google_ad_width = 728;google_ad_height = 90;
    </script>
    <script type="text/javascript"
        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
  • 非同步廣告程式碼
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-publisher-id" crossorigin="anonymous"></script>
    <ins class="adsbygoogle"
        style="display:inline-block;width:728px;height:90px"
        data-ad-client="ca-publisher-id"
        data-ad-slot="1234567890"></ins>
    <script>(adsbygoogle = window.adsbygoogle || []).push({});</script>

如需進一步瞭解您可以對 AdSense 搜尋廣告程式碼做哪些更改,請參閱 AdSense 搜尋廣告政策

這對您有幫助嗎?

我們應如何改進呢?
true
您的 AdSense 頁面

「AdSense 頁面」隆重登場:透過這項全新資源,您可以在帳戶中找到個人化資訊和新商機,運用 AdSense 順利達成目標。

搜尋
清除搜尋內容
關閉搜尋
主選單
522177589300466543
true
搜尋說明中心
true
true
true
true
true
157
false
false