一个 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.