Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Mit der AdMob API können Sie A/B-Tests für die Vermittlung erstellen, um Ihre Anzeigen zu optimieren
verschiedene Konfigurationen testen. Mit einem A/B-Test können Sie
zwei Varianten einer Vermittlungsgruppe, um die Ergebnisse nebeneinander zu vergleichen, und
wählen Sie eine bevorzugte Konfiguration aus.
Beispiele für Tests, die Sie einrichten können:
Anzeigenquellen hinzufügen oder entfernen, um zu sehen, wie sie sich auf Ihre Vermittlungsgruppe auswirken
Eine andere Vermittlungsabfolge verwenden, indem Sie den manuellen eCPM-Wert einer Anzeige ändern
Quellen
Optimierung von abfolgebasierten Anzeigenquellen aktivieren oder deaktivieren
Die Anzahl der Aufrufe einer Anzeigenquelle ändern
Beispiele
Beginnen Sie mit einer bestehenden Vermittlungsgruppe und erstellen Sie eine Variante davon, um
(A oder B) besser abschneidet. Beim Test werden die Nutzer Ihrer App aufgeteilt
der bestehenden Vermittlungsgruppe und der Variante zu vergleichen.
(1%, 10 % oder 50%), den Sie angeben.
Wenn Sie diesen Schritt zum ersten Mal ausführen, werden Sie aufgefordert, eine
zur Autorisierung aufgefordert. Bevor Sie zustimmen, vergewissern Sie sich, dass Sie
Sie müssen mit einem Google-Konto angemeldet sein, das Zugriff auf die AdMob API hat. Ihr
App autorisiert, im Namen des Kontos auf Daten zuzugreifen,
aktuell angemeldet sind.
Zur Authentifizierung und Autorisierung empfehlen wir die Verwendung von
oauth2l ist ein einfaches Befehlszeilentool für
mit Google OAuth 2.0. Installieren Sie oauth2l und führen Sie den folgenden Befehl aus:
Ersetzen von path_to_credentials_json durch einen Pfad zu einem
credentials.json-Datei, die Sie bei der Cloud-Registrierung herunterladen
Bei der ersten Ausführung führt der Befehl Sie durch OAuth 2.0
Autorisierungsablauf. Bei nachfolgenden Ausführungen wird das Token automatisch aktualisiert.
Erstellen Sie einen A/B-Test mit Vermittlungsgruppen.
Ersetzen Sie pub-XXXXXXXXXXXXXXXX durch Ihren Publisher.
ID und ZZZZZZZZZZ durch Ihre
Vermittlungsgruppen-ID. Die Vermittlungsgruppen-ID finden Sie in der AdMob-Benutzeroberfläche oder
mit der Methode
accounts.mediationGroups:list
.
Mit der folgenden Anfrage wird ein A/B-Test mit Vermittlungsgruppen erstellt, bei dem der
Testvariante, auch als Variante B bezeichnet, eine einzelne Vermittlung
für das AdMob-Werbenetzwerk
LIVE-Modus.
Hier sehen Sie die Beispielantwort unten, wobei SSSSSSSSSSSSSSSSSSSSSS für
die erstellte A/B-Test-ID mit Vermittlungsgruppen. YYYYYYYYYY steht für den
die letzten 10 Ziffern Ihres Anzeigenblocks
ID im folgenden Format:
ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY
Prüfen Sie, ob der A/B-Test mit Vermittlungsgruppen ausgeführt wird.
Anruf
accounts.mediationGroups:list
um den Status des A/B-Tests für diese Vermittlungsgruppe abzurufen. Weitere Informationen finden Sie unter
Vermittlungsgruppen
für weitere Informationen
Details.
Die
mediationAbExperimentState
ist für aktive A/B-Tests mit Vermittlungsgruppen auf RUNNING festgelegt und NOT_RUNNING
wenn in der Vermittlungsgruppe kein Test ausgeführt wird.
Beenden Sie den A/B-Test mit Vermittlungsgruppen und wählen Sie eine Variante aus.
Ersetzen Sie pub-XXXXXXXXXXXXXXXX durch Ihren Publisher.
ID und ZZZZZZZZZZ durch Ihre
Vermittlungsgruppen-ID. Die Vermittlungsgruppen-ID finden Sie in der AdMob-Benutzeroberfläche oder
mit der Methode
accounts.mediationGroups:list
.
Geben Sie zum Abschließen des Tests in der Anfrage die beste Variante an:
VARIANT_CHOICE_A: Verwenden Sie die Vermittlungszeilen aus Variante A und schließen Sie den
zu testen. Variante A enthält die ursprünglichen Auslieferungszeilen vor dem
Testerstellung.
VARIANT_CHOICE_B: Verwenden Sie die Vermittlungszeilen aus Variante B und füllen Sie
zu testen. Variante B enthält die neu hinzugefügten Zeilen zur Auslieferung.
[null,null,["Zuletzt aktualisiert: 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 ```"]]