AdManagerAdRequest - Custom targeting
See original GitHub issuePlugin Version
2.0.1
Steps to Reproduce
- Set up the google mobile ad
- Set up AdManagerAdRequest with a customTargeting.
- Enable Network tracing
- See the
onNetworkRequest
logs on your console. The requested URL is inparams.firstline.uri
.
Expected results: See the custom values on the request URL.
Actual results: Nothing changed.
Logs
--
flutter analyze
Analyzing ads...
No issues found! (ran in 0.9s)
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5.1 21G83 darwin-arm, locale en-BR)
• Flutter version 3.0.5 at /Users/eliasreis/Development/flutter/flutter-3-0-5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (8 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/eliasreis/Library/Android/sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.70.2)
• VS Code at /Users/eliasreis/Downloads/Visual Studio Code 2.app/Contents
• Flutter extension version 3.46.0
[✓] VS Code (version 1.64.2)
• VS Code at /Users/eliasreis/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.46.0
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.5.1 21G83 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.102
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Basically, what I would expect with this:
final adManagerAdRequest = AdManagerAdRequest(
customTargeting: {
'appversion': '0.0.1',
},
);
_ad = AdManagerBannerAd(
adUnitId: widget.adUnitId ??
(widget.isIos
? BannerAdContent.iosTestUnitAd
: BannerAdContent.androidTestUnitId),
request: adManagerAdRequest,
sizes: [AdSize.mediumRectangle],
listener: AdManagerBannerAdListener(
onAdLoaded: _onAdLoaded,
onAdFailedToLoad: (_, error) {
if (mounted) setState(() => _adFailedToLoad = true);
},
),
)..load(),
Would be a urlParam called cust_params
with appversion
key and value as 0.0.1
, but It’s not working, do you have any idea why?
Issue Analytics
- State:
- Created a year ago
- Comments:14
Top Results From Across the Web
Targeting | Mobile Ads SDK for Android - Google Developers
The AdManagerAdRequest object collects targeting information to be sent with an ad request. Custom targeting. You can pass custom key-value pairs to target ......
Read more >Targeting types - Google Ad Manager Help
Custom targeting allows you to include key-values, audience segments, or content metadata for video line items if Video Solutions is activated in your...
Read more >AdManagerAdRequest | Firebase - Google
An AdManagerAdRequest contains targeting information used to fetch an ad from Google Ad Manager. Ad requests are created using AdManagerAdRequest.Builder .
Read more >AdManagerAdRequest class - google_mobile_ads library
API docs for the AdManagerAdRequest class from the google_mobile_ads library, for the Dart programming ... Key-value pairs used for custom targeting.
Read more >Targeting | Mobile Ads SDK for Android | Google Developers
Example: Pass custom targeting "age=25". AdManagerAdRequest newRequest = new AdManagerAdRequest.Builder() .addCustomTargeting("age", "25") .build();
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @eliasreis54, by any chance is
BannerAdContent.androidTestUnitId
an Admob ad unit? Does it look like ca-app-pub-…? I think what’s happening is that cust_params is not included for admob ad units, since it’s an ad manager feature.I tried updating the AdManager banner example from the example app and was able to see custom_params in the ad request from debug logs:
However after changing the ad unit to an admob ad unit it looks like cust_params is no longer in the ad request.
@huycozy in your example it also looks like an admob ad unit. If you change the ad unit to
/6499/example/banner
you should see cust_params appear as well. Separately, we should probably update the inline adaptive example to use an ad manager ad unit to avoid confusion.@eliasreis54 Thanks for contributing a PR, let @jjliu15 give more comments on this.