This guide shows you how to use the Google Mobile Ads SDK to load and display ads from AppLovin using mediation, covering both bidding and waterfall integrations. It covers how to add AppLovin to an ad unit's mediation configuration, and how to integrate the AppLovin SDK and adapter into a Flutter app.
Supported integrations and ad formats
The AdMob mediation adapter for AppLovin has the following capabilities:
Integration | |
---|---|
Bidding | |
Waterfall | |
Formats | |
Banner | 1 |
Interstitial | |
Rewarded |
Banner ads (excluding MREC banners) are supported only in mediation. Bidding does not support any type of banner ads.
Requirements
- Latest Google Mobile Ads SDK
- Flutter 3.7.0 or higher
- To deploy on Android
- Android API level 21 or higher
- To deploy on iOS
- iOS deployment target of 12.0 or higher
- A working Flutter project configured with Google Mobile Ads SDK. See Get Started for details.
- Complete the mediation Get started guide
Step 1: Set up configurations in AppLovin UI
Đăng ký hoặc đăng nhập vào tài khoản AppLovin của bạn.
Để thiết lập đơn vị quảng cáo AdMob , bạn sẽ cần có Khoá SDK và Khoá báo cáo của AppLovin. Để tìm các khoá này, hãy chuyển đến Giao diện người dùng AppLovin > Tài khoản > Khoá để xem cả hai giá trị.
Nếu dự định chỉ tích hợp tính năng đặt giá thầu, bạn có thể tiến hành định cấu hình chế độ cài đặt tính năng dàn xếp.
Chọn ứng dụng để dàn xếp
Đặt giá thầu
Bạn không bắt buộc phải thực hiện bước này để tích hợp tính năng đặt giá thầu.
Thác nước
Trên giao diện người dùng AppLovin, hãy chọn Ứng dụng trong mục Kiếm tiền để truy cập vào các ứng dụng bạn đã đăng ký. Chọn ứng dụng mà bạn muốn dùng với tính năng dàn xếp trong danh sách các ứng dụng có sẵn.
Tạo khu vực
Đặt giá thầu
Bạn không bắt buộc phải thực hiện bước này để tích hợp tính năng đặt giá thầu.
Thác nước
Trên giao diện người dùng AppLovin, hãy chọn Khu vực trong phần Kiếm tiền để chuyển đến mã vùng bạn đã đăng ký. Nếu bạn đã tạo các vùng bắt buộc cho ứng dụng, hãy chuyển sang Bước 2. Để tạo mã vùng mới, hãy nhấp vào Tạo vùng.
Nhập tên của Mã khu vực, chọn Android làm Nền tảng rồi chọn Loại quảng cáo.
Định cấu hình giá trị Pricing (Định giá) cho vùng đó bằng cách chọn CPM cố định hoặc Optimized by AppLovin (Tối ưu hoá bởi AppLovin). Bạn có thể định cấu hình CPM trên cơ sở từng quốc gia cho tuỳ chọn CPM cố định. Sau đó, hãy nhấp vào Lưu.
Android
iOS
Sau khi tạo vùng, bạn có thể tìm thấy mã vùng trong cột Mã vùng.
Android
iOS
Bật chế độ thử nghiệm
Làm theo hướng dẫn trong Chế độ thử nghiệm MAX về cách bật quảng cáo thử nghiệm của AppLovin.
Step 2: Set up AppLovin demand in AdMob UI
Định cấu hình cài đặt dàn xếp cho đơn vị quảng cáo của bạn
Android
Để biết hướng dẫn, hãy xem bước 2 trong hướng dẫn dành cho Android.
iOS
Để biết hướng dẫn, hãy xem bước 2 trong hướng dẫn dành cho iOS.
Add AppLovin Corp. to GDPR and US state regulations ad partners list
Hãy làm theo các bước trong cài đặt GDPR và cài đặt quy định của chính phủ Hoa Kỳ để thêm AppLovin Corp. vào GDPR và danh sách đối tác quảng cáo theo quy định của tiểu bang Hoa Kỳ trong AdMob giao diện người dùng.
Step 3: Import the AppLovin SDK and adapter
Tích hợp thông qua pub.dev
Thêm phần phụ thuộc sau đây với các phiên bản mới nhất của
AppLovin SDK và bộ chuyển đổi trong
Tệp pubspec.yaml
:
dependencies:
gma_mediation_applovin: ^1.0.0
Tích hợp thủ công
Tải phiên bản mới nhất của trình bổ trợ dàn xếp Quảng cáo trên thiết bị di động của Google cho
AppLovin!
giải nén tệp đã tải xuống và thêm thư mục trình bổ trợ đã giải nén
(và nội dung trong đó) vào dự án Flutter của bạn. Sau đó, tham chiếu trình bổ trợ trong
pubspec.yaml
bằng cách thêm phần phụ thuộc sau:
dependencies:
gma_mediation_applovin:
path: path/to/local/package
Step 4: Implement privacy settings on AppLovin SDK
EU consent and GDPR
Under the Google EU User Consent Policy, you must ensure that certain disclosures are given to, and consents obtained from, users in the European Economic Area (EEA) regarding the use of device identifiers and personal data. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). When seeking consent, you must identify each ad network in your mediation chain that may collect, receive, or use personal data and provide information about each network's use. Google currently is unable to pass the user's consent choice to such networks automatically.
AppLovin supports reading the consent string from shared preferences and setting the consent status accordingly.If you are
not using a CMP that writes the consent string into the shared
preferences, you can use
GmaMediationApplovin.setHasUserConsent()
and
GmaMediationApplovin.setIsAgeRestrictedUser()
methods. The following sample code shows how
to pass consent information to the AppLovin SDK. These options must be set
before you initialize the Google Mobile Ads SDK
to ensure they get forwarded properly to the AppLovin SDK.
import 'package:gma_mediation_applovin/gma_mediation_applovin.dart';
// ...
GmaMediationApplovin.setHasUserConsent(true);
GmaMediationApplovin.setIsAgeRestrictedUser(true);
See AppLovin's privacy settings for more information.
US states privacy laws
U.S. states privacy laws require giving users the right to opt out of the "sale" of their "personal information" (as the law defines those terms), with the opt-out offered via a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The U.S. states privacy laws compliance guide offers the ability to enable restricted data processing for Google ad serving, but Google is unable to apply this setting to each ad network in your mediation chain. Therefore, you must identify each ad network in your mediation chain that may participate in the sale of personal information and follow guidance from each of those networks to ensure compliance.
The Google Mobile Ads mediation plugin for AppLovin
includes the
GmaMediationApplovin.setDoNotSell()
method. The following sample code shows how to pass
consent information to the AppLovin SDK. These options must be set before you
initialize the Google Mobile Ads
SDK
to ensure they get forwarded properly to the AppLovin SDK.
import 'package:gma_mediation_applovin/gma_mediation_applovin.dart';
// ...
GmaMediationApplovin.setDoNotSell(true);
See AppLovin's Privacy documentation for more information.
Step 5: Add required code
Android
No additional code is required for AppLovin integration.
iOS
SKAdNetwork integration
Follow AppLovin's documentation to add the SKAdNetwork identifiers to your project's Info.plist` file.
Step 6: Test your implementation
Bật quảng cáo thử nghiệm
Hãy nhớ đăng ký thiết bị thử nghiệm cho AdMob và bật chế độ thử nghiệm trong AppLovin giao diện người dùng.
Xác minh quảng cáo thử nghiệm
Để xác minh rằng bạn đang nhận quảng cáo thử nghiệm từ AppLovin, hãy bật thử nghiệm riêng một nguồn quảng cáo trong công cụ kiểm tra quảng cáo bằng cách sử dụng AppLovin (Bidding) and AppLovin (Waterfall) (các) nguồn quảng cáo.
Optional steps
Network-specific parameters
The AppLovin adapter supports passing a AppLovinMediationExtras
object to the
ad request to set network-specific parameters. The following sample code shows
how to disable audio on video ads using the isMuted
parameter:
AppLovinMediationExtras applovinExtras = AppLovinMediationExtras(isMuted: true)
AdRequest request = AdRequest(
keywords: <String>['foo', 'bar'],
contentUrl: 'http://foo.com/bar.html',
mediationExtras: [applovinExtras],
);
Optimizations
Adding a call to
GmaMediationApplovin.initializeSdk('sdkKey')
to your launch activity provides
AppLovin the ability to track events as soon as the app starts.
Error codes
If the adapter fails to receive an ad from AppLovin,
publishers can check the underlying error from the ad response using
ResponseInfo
under the
following classes:
Android
com.google.ads.mediation.applovin.mediation.ApplovinAdapter
com.google.ads.mediation.applovin.AppLovinMediationAdapter
iOS
GADMAdapterAppLovin
GADMAdapterAppLovinRewardBasedVideoAd
GADMediationAdapterAppLovin
Here are the codes and accompanying messages thrown by the AppLovin adapter when an ad fails to load:
Android
Error code | Reason |
---|---|
-1009 to -1, 204 | AppLovin SDK returned an error. See AppLovin's documentation for more details. |
101 | The requested ad size does not match an AppLovin supported banner size. |
103 | Context is null. |
104 | AppLovin bid token is empty. |
105 | Requested multiple ads for the same zone. AppLovin can only load 1 ad at a time per zone. |
106 | Ad is not ready to display. |
108 | AppLovin Adapter does not support the ad format being requested. |
iOS
Error code | Reason |
---|---|
-1009 to -1, 204 | AppLovin SDK returned an error. See AppLovin's documentation for more details. |
101 | The requested ad size does not match an AppLovin supported banner size. |
102 | AppLovin server parameters configured in the AdMob UI are missing/invalid. |
103 | Failed to show AppLovin ad. |
104 | Requested multiple ads for the same zone. AppLovin can only load 1 ad at a time per zone. |
105 | AppLovin SDK key not found. |
107 | Bid token is empty. |
108 | AppLovin Adapter does not support the ad format being requested. |
110 | AppLovin sent a successful load callback but loaded zero ads. |
AppLovin Flutter Mediation Adapter Changelog
1.1.0
- API for the GmaMediationApplovin is no longer static.
- Verified compatibility with AppLovin Android adapter version 12.4.3.0.
- Verified compatibility with AppLovin iOS adapter version 12.4.2.0.
- Built and tested with the Google Mobile Ads Flutter Plugin version 5.1.0.
1.0.0
- Initial release.
- Verified compatibility with AppLovin Android adapter version 12.3.0.0
- Verified compatibility with AppLovin iOS adapter version 12.2.1.0
- Built and tested with the Google Mobile Ads Flutter Plugin version 5.0.0.