Najpierw musisz utworzyć nowe jednostki reklamowe, a potem zaimplementować reklamy w kodzie aplikacji.
W tym samouczku przykładowy przypadek testowy wykorzystuje format reklamy interstitial. Podczas czytania tego samouczka pamiętaj, że możesz wykonać podobne czynności, aby wdrożyć i przetestować limitowanie częstotliwości wyświetlania w przypadku innych formatów reklam.
Sprawdź, czy spełniasz wymagania wstępne dla tego samouczka
Twoja własna aplikacja (projekt na iOS, Androida lub Unity)
Twoja aplikacja zarejestrowana jako aplikacja Firebase połączona z aplikacją AdMob (więcej informacji)
Dostęp do powiązanego z Twoją aplikacją konta AdMob z uprawnieniami do tworzenia nowe jednostki reklamowe
Dostęp do projektu Firebase powiązanego z Twoją aplikacją z uprawnieniami do tworzenia i zarządzaj nimi Remote Config i A/B Testing, a także wyświetlać Google Analytics
Twoje preferowane IDE
Tworzenie jednostki reklamowej
Interfejs AdMob pokazujący, jak utworzyć nową pełnoekranową jednostkę reklamową">
Na koncie AdMob utwórz nową pełnoekranową jednostkę reklamową.
Ustaw limit wyświetleń na użytkownika:
Rozwiń Ustawienia zaawansowane w interfejsie użytkownika AdMob, a następnie włącz Ograniczenie liczby wyświetleń.
Określ częstotliwość wyświetlania reklam, którą chcesz przetestować. Wybierz częstotliwość wyższą niż ta używana w dotychczasowej jednostce reklamowej.
Załóżmy na przykład, że istniejąca pełnoekranowa jednostka reklamowa ma 4 wyświetlenia. na użytkownika na 10 minut, ale chcesz sprawdzić, czy możesz zwiększyć Limit wynosi 6 wyświetleń na użytkownika na 10 minut.
Zalecamy, aby czas trwania (np. „co 10 minut”) był taki sam w przypadku wszystkich porównywanych jednostek reklamowych. Pozostałe ustawienia jednostki reklamowej nie są istotnymi w tym konkretnym samouczku, więc wybierz ustawienia odpowiednie dla Twojej aplikacji.
Interfejs AdMob pokazujący, jak ustawić ograniczenie liczby wyświetleń dla nowej jednostki reklamowej class="Zrzuty ekranu">
Powtórz powyższe kroki, jeśli chcesz dodać kolejną jednostkę pełnoekranową do przetestować jeszcze wyższy limit wyświetleń na użytkownika. W tym samouczku utworzyliśmy kolejny jednostkę reklamową z 8 wyświetleniami na użytkownika na 10 minut.
Implementowanie jednostki reklamowej
Interfejs AdMob z nowym identyfikatorem jednostki reklamowej i instrukcjami integracji pakietu SDK">
Po utworzeniu każdej jednostki reklamowej AdMob udostępnia jej unikalny identyfikator jednostki reklamowej. Pamiętaj, gdzie znaleźć ten identyfikator jednostki reklamowej na koncie AdMob co jest potrzebne do zaimplementowania reklamy w aplikacji.
Postępuj zgodnie z instrukcjami na ekranie, aby zintegrować pakietu SDK Google Mobile Ads (AdMob) i zaimplementować nową jednostkę reklamową w aplikacji.
Po utworzeniu 2 nowych jednostek reklamowych typu interstitial na koncie AdMob dla tej konkretnej aplikacji powinny być widoczne 3 jednostki reklamowe. W kolejnych krokach tego samouczka skonfigurujesz Firebase tak, aby używać tych jednostek w teście A/B z użyciem tego samego miejsca docelowego.
Interfejs AdMob ze wszystkimi jednostkami reklamowymi aplikacji class="Zrzuty ekranu">
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-07-24 UTC."],[],[],null,["Step 1: Use AdMob to create new ad unit variants for testing\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------|\n| Introduction: [Optimize AdMob ad frequency using Firebase](/docs/tutorials/optimize-ad-frequency) |\n| **Step 1: Use AdMob to create new ad unit variants for testing** \u003cbr /\u003e |\n| Step 2: [Set up an A/B test in the Firebase console](/docs/tutorials/optimize-ad-frequency/step-2) |\n| Step 3: [Handle Remote Config parameter values in your app's code](/docs/tutorials/optimize-ad-frequency/step-3) |\n| Step 4: [Start the A/B test and review the test results in the Firebase console](/docs/tutorials/optimize-ad-frequency/step-4) |\n| Step 5: [Decide whether to roll out the new ad format](/docs/tutorials/optimize-ad-frequency/step-5) |\n\n\u003cbr /\u003e\n\nTo get started, you first need to create new ad units and then implement the ads\nin your app's code.\n\nThis tutorial uses the\n[interstitial](https://support.google.com/admob/answer/9884467) ad\nformat as the example test case. When reading this tutorial, though, keep in\nmind that you could follow similar steps to implement and test frequency capping\nfor other ad formats.\n\n\u003cbr /\u003e\n\n**Make sure you have the prerequisites for this tutorial**\n\n\u003cbr /\u003e\n\n- Your own app (iOS, Android, or Unity project)\n\n- Your app registered as a Firebase App that's linked to an AdMob App\n ([learn more](//support.google.com/admob/answer/6383165))\n\n- Access to your app's associated AdMob account, with permissions to create\n new ad units\n\n- Access to your app's associated Firebase project, with permissions to create\n and manage Remote Config and A/B Testing as well as to view\n Google Analytics\n\n- Your preferred IDE\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n**Create an ad unit**\n\nAdMob UI showing how to create a new interstitial ad unit\"\\\u003e\n\n1. In your AdMob account, create a new *Interstitial* ad unit.\n\n2. Set the frequency cap:\n\n 1. Expand the **Advanced settings** in the AdMob UI, then enable\n **Frequency capping**.\n\n 2. Specify an ad frequency that you want to test. Choose a frequency that's\n higher than the frequency used in your existing ad unit.\n\n For example, suppose your existing interstitial ad unit shows 4 impressions\n per user per 10 minutes, but you want to test out if you can increase the\n cap to *6 impressions* per user per 10 minutes.\n\n We recommend keeping the time duration (that is, \"per 10 minutes\")\n consistent across the ad units being compared. The other ad unit settings,\n though, aren't important for this particular tutorial, so select settings\n that are appropriate for your app.\n AdMob UI showing how to set the frequency capping for the new ad unit\" class=\"screenshot\"\\\u003e\n3. Repeat the steps above if you'd like to add another interstitial unit to\n test out an even higher frequency cap. For this tutorial, we created another\n ad unit with *8 impressions* per user per 10 minutes.\n\n**Implement the ad unit**\n\nAdMob UI displaying new ad unit ID and instructions for integrating the SDK\"\\\u003e\n\nAfter you create each ad unit, AdMob provides you with the ad unit's unique\n**ad unit ID** . Remember where to find this ad unit ID in your AdMob account\nas you'll need it to implement the ad into your app.\n\nFollow the on-screen instructions to integrate the\nGoogle Mobile Ads (AdMob) SDK and to implement the new ad unit into your app.\n\nAfter creating two new interstitial ad units, you should now have three ad units\nlisted in your AdMob account for this specific app. In the next steps of\nthis tutorial, you'll configure Firebase to use each of these ad units in an A/B\ntest using the *same ad placement*.\nAdMob UI displaying all ad units for the app\" class=\"screenshot\"\\\u003e\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\n[arrow_back_ios**Introduction**](/docs/tutorials/optimize-ad-frequency)\n[**Step 2** : Set up an A/B test in the Firebase consolearrow_forward_ios](/docs/tutorials/optimize-ad-frequency/step-2)\n\n\u003cbr /\u003e\n\n*** ** * ** ***"]]