סגנונות מותאמים
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
הגדרות של סגנונות מותאמים
מאפשרות ל-Google Ad Manager לטפל בעיבוד של המודעות המותאמות על סמך סגנונות מותאמים שאתם מציינים במוצר. קודם כול, מציינים את הגודל ואת הטירגוט.
לאחר מכן מוסיפים HTML, CSS ו-JavaScript כדי להגדיר מודעות רספונסיביות שמוצגות באיכות גבוהה בכל המסכים. אתם לא צריכים לבצע שום עיבוד. Ad Manager מחיל באופן אוטומטי את הסגנון המקורי המתאים ליעד. ההטמעה של סגנונות מותאמים מתבצעת בדיוק כמו ההטמעה של מודעות באנר,
באמצעות AdManagerAdView
. אפשר להשתמש בהן עם גודל מודעה קבוע שנקבע מראש, או עם גודל מודעה משתנה שנקבע בזמן הריצה.
דרישות מוקדמות
- Google Mobile Ads Flutter Plugin מגרסה 0.13.6 ואילך
המדריך הזה מיועד למי שיש לו ידע בסיסי ב-Google Mobile Ads SDK.
אם עדיין לא עשיתם את זה, מומלץ לעיין במדריך תחילת העבודה.
גודל קבוע
סגנונות מותאמים עם גודל קבוע מאפשרים לכם לשלוט ברוחב ובגובה של המודעה המותאמת. כדי להגדיר גודל קבוע, מבצעים את השלבים הבאים:
יוצרים פריט בממשק המשתמש של Ad Manager ובוחרים אחד מהגדלים המוגדרים מראש בתפריט הנפתח של השדה Size
.
טוענים AdManagerBannerAd
באותו גודל שהגדרתם בשלב 1.
במסמכי התיעוד בנושא מודעות באנר מוסבר איך ליצור מופע של מודעה ואיך לטעון אותה.
בקטע גודל הבאנר מופיעה רשימה של הגדלים והAdSize
קבועים התואמים.
דוגמה לאופן שבו מציינים גודל קבוע, כמו גודל המודעה MEDIUM_RECTANGLE
(300x250):
AdManagerBannerAd ad = AdManagerBannerAd(
adUnitId: '<your-ad-unit>',
sizes: <AdSize>[AdSize.mediumRectangle],
request: AdManagerAdRequest(),
);
גודל הנוזל
במקרים מסוימים, גודל קבוע לא מתאים. לדוגמה, יכול להיות שתרצו שהרוחב של המודעה יתאים לתוכן של האפליקציה, אבל תצטרכו שהגובה שלה ישתנה באופן דינמי כדי להתאים לתוכן של המודעה. כדי לטפל במקרה הזה, אפשר לציין Fluid
כגודל המודעה בממשק המשתמש של Ad Manager. כך המערכת תדע שגודל המודעה נקבע בזמן הריצה באפליקציה. ה-SDK מספק קבוע מיוחד AdSize
, FLUID
, כדי לטפל במקרה הזה.
הגובה של מודעה בגודל משתנה נקבע באופן דינמי על סמך הרוחב שהוגדר על ידי בעל האתר. כך, גובה תצוגת המודעה בפלטפורמה מותאם לגובה הקריאייטיב.
בקשה גמישה
כדי לבקש מודעה גמישה, משתמשים בFluidAdManagerBannerAd
:
final fluidAd = FluidAdManagerBannerAd(
adUnitId: '<your-ad-unit>',
request: AdManagerAdRequest(),
listener: AdManagerBannerAdListener(
onAdLoaded: (Ad ad) {
print('$_fluidAd loaded.');
},
onAdFailedToLoad: (Ad ad, LoadAdError error) {
print('$_fluidAd failedToLoad: $error');
ad.dispose();
},
),
הצגת המודעה הגמישה
אחרי שהמודעה נטענת, משתמשים ב-FluidAdWidget
כדי להציג מודעות גמישות. הגובה של מודעת העוגן ישתנה בהתאם לגובה של אזור הצפייה במודעה בפלטפורמה הבסיסית:
FluidAdWidget(
width: <your-width>,
ad: fluidAd,
);
אפשר לראות דוגמה להטמעה של גודל מודעה גמיש ב-Ad Manager באפליקציה לדוגמה ב-Github.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-09-06 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-09-06 (שעון UTC)."],[[["\u003cp\u003eNative style settings in Google Ad Manager allow you to customize the look and feel of your native ads using HTML, CSS, and JavaScript for a seamless user experience.\u003c/p\u003e\n"],["\u003cp\u003eYou can define fixed-size native ads by specifying their dimensions in the Ad Manager UI and using corresponding \u003ccode\u003eAdSize\u003c/code\u003e constants when loading the ad in your app.\u003c/p\u003e\n"],["\u003cp\u003eAlternatively, fluid-size native ads dynamically adjust their height based on the width you provide, ensuring responsiveness across different screens using the \u003ccode\u003eFluidAdManagerBannerAd\u003c/code\u003e and \u003ccode\u003eFluidAdWidget\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo implement native ads, you need Google Mobile Ads Flutter Plugin version 0.13.6 or higher and basic familiarity with the Google Mobile Ads SDK.\u003c/p\u003e\n"]]],["Google Ad Manager renders native ads based on specified styles. Users define ad size and targeting, then add HTML, CSS, and JavaScript for responsive design. Fixed ad sizes are set in the Ad Manager UI and loaded using `AdManagerBannerAd` with corresponding `AdSize` constants. Fluid ads use `Fluid` in the UI and the `FLUID` constant, with `FluidAdManagerBannerAd` for requests and `FluidAdWidget` for display, dynamically adjusting the height.\n"],null,["Select platform: [Android](/ad-manager/mobile-ads-sdk/android/native/styles \"View this page for the Android platform docs.\") [iOS](/ad-manager/mobile-ads-sdk/ios/native/styles \"View this page for the iOS platform docs.\") [Flutter](/ad-manager/mobile-ads-sdk/flutter/native/styles \"View this page for the Flutter platform docs.\")\n\n\u003cbr /\u003e\n\n[Native style settings](//support.google.com/admanager/answer/6366914)\nenable Google Ad Manager to handle the rendering of your native ads based on native\nstyles you specify within the product. First, specify size and targeting.\nThen add HTML, CSS, and JavaScript to define ads that are responsive\nand produce a quality display across all screens. You don't need to do\nany of the rendering; Ad Manager automatically applies the right native style\nfor the destination. Native styles are implemented just like banner ads,\nusing a `AdManagerAdView`. They can be used with a fixed ad\nsize determined ahead of time, or a fluid ad size determined at runtime.\n\nPrerequisites\n\n- Google Mobile Ads Flutter Plugin version 0.13.6 or higher\n\nThis guide assumes some working knowledge of the Google Mobile Ads SDK.\nIf you haven't already done so, consider running through our\n[Get Started](/ad-manager/mobile-ads-sdk/flutter/quick-start) guide.\n\nFixed size\n\nNative styles with a fixed size allow you to control the width and height\nof the native ad. To set a fixed size, follow these steps:\n\n1. Create a line item in the Ad Manager UI and select one of the\n predefined sizes from the `Size` field dropdown.\n\n2. Load an `AdManagerBannerAd` with the same size you set up in step 1.\n See the [Banner Ad](/ad-manager/mobile-ads-sdk/flutter/banner/get-started#instantiate_ad)\n documentation for how to instantiate and load an ad.\n You can see a list of sizes and their corresponding `AdSize` constants\n in the [Banner size](/ad-manager/mobile-ads-sdk/flutter/banner/get-started#banner_sizes)\n section.\n\nHere's an example of how to specify a fixed size, such as the\n`MEDIUM_RECTANGLE` (300x250) ad size: \n\n AdManagerBannerAd ad = AdManagerBannerAd(\n adUnitId: '\u003cyour-ad-unit\u003e',\n sizes: \u003cAdSize\u003e[AdSize.mediumRectangle],\n request: AdManagerAdRequest(),\n );\n\nFluid size\n\nIn some cases, a fixed size may not make sense. For example, you may\nwant the width of the ad to match your app's content, but need its height\nto dynamically adjust to fit the ad's content. To handle this case,\nyou can specify `Fluid` as the ad size in the Ad Manager UI, which\ndesignates that the size of the ad is determined at runtime in the app.\nThe SDK provides a special `AdSize` constant, `FLUID`, to handle this case.\nThe fluid ad size height is dynamically determined based on the publisher\ndefined width, allowing the platform ad view to adjust its height to match that\nof the creative.\n\nFluid request\n\nUse `FluidAdManagerBannerAd` to request a fluid ad: \n\n final fluidAd = FluidAdManagerBannerAd(\n adUnitId: '\u003cyour-ad-unit\u003e',\n request: AdManagerAdRequest(),\n listener: AdManagerBannerAdListener(\n onAdLoaded: (Ad ad) {\n print('$_fluidAd loaded.');\n },\n onAdFailedToLoad: (Ad ad, LoadAdError error) {\n print('$_fluidAd failedToLoad: $error');\n ad.dispose();\n },\n ),\n\nDisplaying the fluid ad\n\nAfter your ad is loaded, use `FluidAdWidget` to display fluid ads. It will\nadjust its height to match the underlying platform ad view: \n\n FluidAdWidget(\n width: \u003cyour-width\u003e,\n ad: fluidAd,\n );\n\nSee an example implementation of Ad Manager Fluid ad size in the example app\non [Github](https://github.com/googleads/googleads-mobile-flutter/blob/master/packages/google_mobile_ads/example/lib/fluid_example.dart)."]]