下面介紹了如何使用Google的AdSense來為你的網站設置廣告。基本內容包括:
- 創建一個AdSense賬號,你必須18歲以上,有一個Google賬號以及地址
- 你的網站必須已經被激活,并且你的網站內容必須符合AdSense政策
- 創建響應式布局廣告單元,可以在任何的設備上自動調整廣告大小
- 確保payment的設置,坐等錢來
創建一個包含廣告的簡單網頁
在排練預演中,你將要創建一個包含響應式廣告的簡單頁面,使用Google AdSense和Web Start Kit。
如果你不熟悉 Web Start Kit, 參考 Set Up Web Starter Kit 文檔
為了讓你的網站包含廣告且賺錢,你需要遵循以下步驟
- 創建一個 AdSense賬號
- 創建廣告單元(ad units)
- 將你的廣告放置在頁面上
- 設置你的payment
創建一個AdSense賬號
為了使用AdSense服務,你首先得創建一個AdSense賬號,創建賬號得遵從如下條件:
創建廣告單元
一個廣告單元是一系列將展現在你網頁中的廣告,它們將通過你網頁中的js來實現。你有以下三種方式來控制你廣告單元的大?。?/p>
如果你的網站是響應式布局的網站,那么使用響應式布局的廣告。如果你不使用響應式布局廣告單元模式,那么你講書寫一大堆的代碼來讓廣告在不同設備上顯示不同的大小。
在Google AdSense 中Guide to ad sizes 中追蹤最好的廣告大小 top performing ad sizes 。
創建響應式布局廣告單元
- Visit the My ads tab.
- Click +New ad unit.
- Give your ad unit a unique name. This name appears in the ad code that’s pasted into your site, so be descriptive.
- Select Responsive from the Ad size drop-down.
- Select Text & display ads from the Ad type drop-down.
- Click Save and get code.
- In the Ad code box that appears, select the Smart sizing (recommended) option from the Mode drop-down. This is the recommended mode and doesn’t require you to make any changes to your ad code.
創建你的廣告單元之后,AdSense 提供了一個包含你的網站的代碼,相似如下:
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><!-- Top ad in web starter kit sample --><ins class="adsbygoogle" style="display:block" data-ad-client="XX-XXX-XXXXXXXXXXXXXXXX" data-ad-slot="XXXXXXXXXX" data-ad-format="auto"></ins><script> (adsbygoogle = window.adsbygoogle || []).push({});</script>
Note
-
data-ad-client
和 data-ad-slot
對每一個你創建的廣告而言都是獨一無二的 -
data-ad-format=auto
標簽在創建廣告代碼時允許響應式布局廣告單元中的廣告自適應設備大小
將廣告單元包含到你的網站中
為了將廣告包含到你的網站中,你需要在你的網頁中嵌入上面AdSense生成的代碼。
如果你想要生成多個廣告,你得為你的廣告重新使用廣告模式亦或創建多個廣告單元。
- 在app文件夾中打開index.html
- 將你的代碼嵌入到main標簽中
- 保存文件,打開瀏覽器使用谷歌開發工具中的移動端設備視圖查看效果
Remember
- 將所有的廣告代碼放置在body標簽里面,否則,廣告將不會起作用!
設置payment參數
想知道在AdSense中你如何獲利?
- Verify you’ve provided any required tax information in the payee profile.
- Confirm your payee name and address are correct.
- Select your form of payment on the Payment settings page.
- Enter your personal identification number (PIN). This PIN verifies the accuracy of your account information.
- Check to see if your balance reaches the payment threshold.
查看跟多消息: Intro to AdSense payments
原文:https://developers.google.com/web/fundamentals/discovery-and-monetization/monetization-with-ads/include-ads?hl=en
本站僅提供存儲服務,所有內容均由用戶發布,如發現有害或侵權內容,請
點擊舉報。