Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Interfejs AdMob API może tworzyć eksperymenty A/B zapośredniczenia, aby zmaksymalizować skuteczność Twoich reklam
przez testowanie różnych konfiguracji. Test A/B pozwala ocenić
dwóch odmian grupy zapośredniczenia, aby porównać wyniki
wybierz preferowaną konfigurację.
Oto przykłady eksperymentów, które możesz skonfigurować:
dodaj lub usuń źródła reklam, aby poznać ich wpływ na grupę zapośredniczenia;
Wykorzystanie innej kolejności w kaskadzie poprzez zmianę samodzielnie ustalanej wartości eCPM reklamy
źródła
włączenie lub wyłączenie optymalizacji kaskadowych źródeł reklam;
zmianę liczby wywołań źródła reklam,
Przykłady
Zacznij od istniejącej grupy zapośredniczenia i utwórz jej odmianę, aby zobaczyć,
który wariant – A lub B – jest skuteczniejszy. W ramach testu następuje podzielenie użytkowników aplikacji
między istniejącą konfiguracją grupy zapośredniczenia a odmianą, na podstawie
(1%, 10% lub 50%).
Gdy pierwszy raz wykonasz ten krok, pojawi się prośba o zaakceptowanie
komunikat autoryzacyjny w przeglądarce. Zanim zaakceptujesz zaproszenie,
są zalogowane za pomocą konta Google z dostępem do interfejsu AdMob API. Twoje
aplikacja będzie mieć dostęp do danych w imieniu
Użytkownik jest obecnie zalogowany.
Do uwierzytelniania i autoryzacji zalecamy użycie
oauth2l – proste narzędzie wiersza poleceń
korzysta z protokołu Google OAuth 2.0. Zainstaluj oauth2l i uruchom poniższe polecenie:
zastępując path_to_credentials_json ścieżką do
credentials.json plik, który pobierasz podczas rejestracji chmury
. Przy pierwszym uruchomieniu polecenie przeprowadzi Cię przez interfejs OAuth 2.0
proces autoryzacji. Kolejne uruchomienia automatycznie odświeżają token.
To żądanie tworzy eksperyment A/B zapośredniczenia, w którym
wariant eksperymentalny, nazywany też wariantem B, zawiera 1 zapośredniczenie
dla sieci AdMob, używając
Tryb LIVE.
Zobacz przykładową odpowiedź poniżej, gdzie SSSSSSSSSSSSSSSSSSSSSS reprezentuje:
identyfikator utworzonego eksperymentu A/B zapośredniczenia, a element YYYYYYYYYY reprezentuje
ostatnich 10 cyfr jednostki reklamowej
ID, zgodnie z formatem:
ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY.
mediationAbExperimentState
jest ustawiona na RUNNING w przypadku aktywnych eksperymentów A/B zapośredniczenia i NOT_RUNNING
jeśli w grupie zapośredniczenia nie jest uruchomiony żaden eksperyment.
Aby zakończyć eksperyment, wskaż w żądaniu zwycięski wariant:
VARIANT_CHOICE_A: użyj wierszy zapośredniczenia z wariantu A i przejdź
eksperymentu. Wariant A zawiera oryginalne wiersze wyświetlania przed
tworzenia eksperymentu.
VARIANT_CHOICE_B: skorzystaj z wierszy zapośredniczenia z wariantu B i wykonaj podane niżej czynności
eksperymentu. Wariant B zawiera nowo dodane wiersze wyświetlania.
[null,null,["Ostatnia aktualizacja: 2025-08-31 UTC."],[[["\u003cp\u003eThe AdMob API enables the creation of mediation A/B experiments to optimize ad performance by comparing different mediation group configurations.\u003c/p\u003e\n"],["\u003cp\u003eYou can test variations like adding/removing ad sources, adjusting waterfall order, enabling/disabling optimization, and modifying ad source call frequency.\u003c/p\u003e\n"],["\u003cp\u003eExperiments split app users between the existing setup and a variation to determine the better performer, with traffic allocation options of 1%, 10%, or 50%.\u003c/p\u003e\n"],["\u003cp\u003eA mediation group can only have one active A/B experiment running at any given time.\u003c/p\u003e\n"],["\u003cp\u003eExperiments are managed using curl commands to create, monitor, and conclude the test, ultimately choosing the preferred variant for your mediation group.\u003c/p\u003e\n"]]],["The AdMob API facilitates mediation A/B experiments to optimize ad performance by comparing two mediation group configurations. Experiments can involve adding/removing ad sources, adjusting waterfall order/eCPM, enabling/disabling optimization, or changing call frequency. To set up an experiment, you must create a variation (variant B) of an existing mediation group (variant A), and define the percentage of users that will see variant B. To use the API, it is required to obtain an authorization, then you can create, check the status and stop the experiments. Only one experiment can be active in each mediation group at a time.\n"],null,["# Mediation A/B experiment\n\nThe AdMob API can create mediation A/B experiments to maximize your ads\nperformance by testing various configurations. An A/B test lets you evaluate\ntwo variations of a mediation group to compare the results side by side and\nselect a preferred configuration.\n\nHere are examples of experiments you can set up:\n\n- Adding or removing ad sources to see their impact on your mediation group\n- Using a different waterfall order by changing the manual eCPM value of ad sources\n- Enabling or disabling optimization on waterfall ad sources\n- Changing the number of times an ad source is called\n\nExamples\n--------\n\nStart with an existing mediation group and create a variation of it to see\nwhich variant, A or B, performs better. The test splits your app's users\nbetween your existing mediation group setup and the variation, based on a\npercentage (1%, 10%, or 50%) you provide.\n**Key Point:** A mediation group can only run one mediation A/B experiment at a time. \n\n### curl (command line)\n\n### Requests using curl\n\n1. **Load the [client secrets file](https://console.cloud.google.com/apis/credentials) and generate authorization\n credentials.**\n\n The first time you perform this step, you are asked to accept an\n authorization prompt in your browser. Before accepting, make sure you're\n signed in with a Google Account that has access to the AdMob API. Your\n app will be authorized to access data on behalf of whichever account is\n currently logged in.\n\n For authentication and authorization, we recommend using\n [oauth2l](//github.com/google/oauth2l), a simple command-line tool for\n working with Google OAuth 2.0. Install oauth2l and run the command below,\n replacing \u003cvar translate=\"no\"\u003epath_to_credentials_json\u003c/var\u003e with a path to a\n `credentials.json` file that you download when registering your cloud\n app. For the first run, the command walks you through the OAuth 2.0\n authorization flow. Subsequent runs refresh the token automatically. \n\n ```\n oauth2l header --json path_to_credentials_json --scope admob.monetization,admob.readonly\n ```\n2. **Create a mediation A/B experiment.**\n\n Replace `pub-XXXXXXXXXXXXXXXX` with your [publisher\n ID](//support.google.com/admob/answer/2784578) and `ZZZZZZZZZZ` with your\n mediation group ID. The mediation group ID can be found in the AdMob UI or\n by using the\n [`accounts.mediationGroups:list`](/admob/api/reference/rest/v1beta/accounts.mediationGroups/list)\n method.\n\n You need to specify the\n [`treatmentMediationLines`](/admob/api/reference/rest/v1beta/accounts.mediationGroups.mediationAbExperiments)\n and\n [`treatmentTrafficPercentage`](/admob/api/reference/rest/v1beta/accounts.mediationGroups.mediationAbExperiments),\n however, the\n [`controlMediationLines`](/admob/api/reference/rest/v1beta/accounts.mediationGroups.mediationAbExperiments)\n are inherited from the parent mediation group and do not need to be\n specified.\n | **Key Point:** Possible values for `treatmentTrafficPercentage` are 1, 10, or 50, representing 1%, 10%, and 50%, respectively.\n\n The following request creates a mediation A/B experiment where the\n treatment variant, also known as variant B, contains a single mediation\n line for the AdMob network using\n [`LIVE`](/admob/api/reference/rest/v1beta/MediationGroupLine#cpmmode) mode. \n\n ```\n curl --http1.0 \\\n -X POST https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/mediationGroups/ZZZZZZZZZZ/mediationAbExperiments \\\n -H \"Content-Type:application/json\" \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.monetization)\" \\\n --data @- \u003c\u003c EOF\n {\n \"displayName\":\"Mediation A/B Experiment Test Name\",\n \"treatmentTrafficPercentage\": \"50\",\n \"treatmentMediationLines\": [{\n \"mediationGroupLine\": {\n \"displayName\": \"Test mediation group line\",\n \"adSourceId\": \"5450213213286189855\",\n \"cpm_mode\": \"LIVE\"\n }\n }]\n }\n EOF\n ```\n\n See the sample response below where `SSSSSSSSSSSSSSSSSSSSSS` represents\n the created mediation A/B experiment ID and `YYYYYYYYYY` represents the\n last 10 digits of your [ad unit\n ID](//support.google.com/admob/answer/7356431), complying to the format:\n `ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY`. \n\n ```text\n {\n \"name\": \"accounts/pub-XXXXXXXXXXXXXXXX/mediationGroups/ZZZZZZZZZZ/mediationAbExperiments/SSSSSSSSSSSSSSSSSSSSSS\",\n \"displayName\": \"Mediation A/B Experiment Test Name\",\n \"experimentId\": \"SSSSSSSSSSSSSSSSSSSSSS\",\n \"treatmentTrafficPercentage\": \"50\",\n \"treatmentMediationLines\": [\n {\n \"mediationGroupLine\": {\n \"id\": \"11111111111111111\",\n \"displayName\": \"Test mediation group line\",\n \"adSourceId\": \"5450213213286189855\",\n \"cpmMode\": \"LIVE\",\n \"cpmMicros\": \"10000\",\n \"adUnitMappings\": {\n \"ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY\": \"accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings/\n \"ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY\": \"accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings/\n },\n \"state\": \"ENABLED\"\n }\n }\n ],\n \"controlMediationLines\": [\n {\n \"mediationGroupLine\": {\n \"id\": \"22222222222222222\",\n \"displayName\": \"AdMob Network (control)\",\n \"adSourceId\": \"5450213213286189855\",\n \"cpmMode\": \"LIVE\",\n \"cpmMicros\": \"10000\",\n \"adUnitMappings\": {\n \"ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY\": \"accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings/\n \"ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY\": \"accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings/\n },\n \"state\": \"ENABLED\"\n }\n }\n ],\n \"state\": \"RUNNING\"\n }\n ```\n3. **Verify the mediation A/B experiment is running.**\n\n Call\n [`accounts.mediationGroups:list`](/admob/api/reference/rest/v1beta/accounts.mediationGroups/list)\n to get the mediation A/B experiment status for that mediation group. See\n the [mediation groups\n guide](/admob/api/v1/mediation-groups) for more\n details.\n\n The\n [`mediationAbExperimentState`](/admob/api/reference/rest/v1beta/accounts.mediationGroups.mediationAbExperiments#experimentstate)\n is set to `RUNNING` for active mediation A/B experiments and `NOT_RUNNING`\n if there is no experiment running in the mediation group.\n\n Sample request: \n\n ```\n curl --http1.0 \\\n -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/mediationGroups \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.readonly)\"\n ```\n4. **Stop the mediation A/B experiment and select a variant.**\n\n Replace `pub-XXXXXXXXXXXXXXXX` with your [publisher\n ID](//support.google.com/admob/answer/2784578) and `ZZZZZZZZZZ` with your\n mediation group ID. The mediation group ID can be found in the AdMob UI or\n by using the\n [`accounts.mediationGroups:list`](/admob/api/reference/rest/v1beta/accounts.mediationGroups/list)\n method.\n\n To complete the experiment, specify the winning variant in the request:\n - `VARIANT_CHOICE_A`: Use the mediation lines from Variant A and complete the experiment. Variant A contains the original serving lines before the experiment creation.\n - `VARIANT_CHOICE_B`: Use the mediation lines form Variant B and complete the experiment. Variant B contains the newly added serving lines.\n\n Sample request: \n\n curl --http1.0 \\\n -X POST https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/mediationGroups/ZZZZZZZZZZ/mediationAbExperiments:stop \\\n -H \"Content-Type:application/json\" \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.monetization)\" \\\n --data @- \u003c\u003c EOF\n {\n \"variantChoice\": \"VARIANT_CHOICE_A\"\n }\n\n Sample response: \n\n ```text\n {\n \"experimentId\": \"SSSSSSSSSSSSSSSSSSSSSS\",\n \"state\": \"EXPIRED\",\n }\n ```"]]