一個 Flutter 插件,可實現與 Google Ad Manager(先前稱為 DoubleClick for Publishers)的整合,讓開發者能在其 Flutter 應用中顯示廣告。此插件提供與原生廣告 SDK 的橋接功能,支援橫幅廣告、插頁廣告及獎勵視頻廣告。透過簡單直覺的 API,該插件簡化廣告整合流程,同時維持跨平台相容性。此插件專為希望透過 Google 生態系統進行程式化廣告收益的應用所設計。
適用情境
透過展示廣告 monetizing 移動應用
實施獎勵視頻廣告以提高用戶參與度
在應用佈局中顯示橫幅廣告
在應用螢幕之間整合插頁廣告
使用 Google Ad Manager 提供定向廣告
透過程式化競標啟用廣告收入
主要特色
支援橫幅、插頁和獎勵視頻廣告
與 Google Ad Manager 的輕鬆整合
跨平台廣告投放
即時廣告取得與呈現
廣告事件回調,用於追蹤效能
符合 Google AdMob 政策
適合對象
尋求廣告變現的應用程式
使用 Google Ad Manager 進行廣告庫存的開發者
面向全球受眾的Flutter應用
管理多個廣告網絡的發布商
需要高廣告填充率的應用
需要可靠廣告表現追蹤的項目
使用建議
需要設定 Google Ad Manager 帳號
需要來自出版商儀表板的正確廣告單元ID
可能需要遵守如GDPR之類的隱私法規
性能取決於網路連接
廣告內容必須遵循谷歌的廣告政策
iOS 和 Android 清單檔案需要額外設定
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
flutter_google_ad_manager
Flutter plugin for Google Ad Manager(DoubleClick for Publishers).
Getting Started
ios
Add io.flutter.embedded_views_preview in info.plist
You can manually refresh the banner ads on user interaction, use the onAdViewCreated callback to save an instance of the DFPBannerViewController and then call the reload() method to refresh the ad.
If you set isDevelop to true, the test adUnitId will be used.
( If set false, the described adUnitId is used.)
Google Ad Manger needs to register testDevices in case of actual devices.
With this plug-in, you can create the following class and set it to testDevices of DFPBanner.
classMyTestDevicesextendsTestDevices{
staticMyTestDevices _instance;
factoryMyTestDevices() {
if (_instance == null) _instance = newMyTestDevices._internal();
return _instance;
}
MyTestDevices._internal();
@overrideList<String> get values => List()..add("XXXXXXXX"); // Set here.
}
DFPBanner(
testDevices: MyTestDevices(),
)
About adSize
DFPAdSize is available. This is the same size as that of android.