광고 단위 매핑
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
광고 단위 매핑은 AdMob 광고 단위에 매핑되어 서드 파티 광고 네트워크에 광고를 요청할 수 있게 하는 서드 파티 구성 설정입니다.
미디에이션 그룹을 만들 때 광고 단위 매핑은 각 미디에이션 그룹 라인의 매개변수로, 지정된 광고 단위가 서드 파티 광고 네트워크 요청을 할 때의 설정으로 사용됩니다.
AdMob UI와 달리 광고 단위 매핑은 미디에이션 그룹 및 미디에이션 그룹 행 밖에서 독립적으로 만들어야 합니다.
생성 후 모든 광고 단위 매핑을 나열하고 새 광고 단위 매핑으로 미디에이션 그룹 라인을 만들거나 업데이트할 때 매핑을 매개변수로 사용할 수 있습니다.
예
OAuth 2.0 사용자 인증 정보가 생성되면
AdMob API를 사용할 수 있습니다. OAuth 2.0을 사용하여 액세스를 요청하려면 애플리케이션에 범위 정보도 필요합니다.
다음은 OAuth 2.0 범위 정보입니다.
범위 |
의미 |
https://www.googleapis.com/auth/admob.monetization |
AdMob 수익 창출 설정을 확인, 생성, 수정합니다.
|
https://www.googleapis.com/auth/admob.readonly |
모든 AdMob 데이터를 확인합니다. 여기에는 계정 정보, 인벤토리 및 미디에이션 설정, 보고서 및 기타 데이터가 포함될 수 있습니다.
결제나 캠페인 세부정보와 같은 민감한 정보는 포함되지 않습니다.
|
첫 번째 광고 단위 매핑을 만들어 보세요.
curl (명령줄)
curl을 사용하는 요청
클라이언트 보안 비밀번호 파일을 로드하고 승인 사용자 인증 정보를 생성합니다.
이 단계를 처음 수행하면 브라우저에서 승인 메시지를 수락하라는 메시지가 표시됩니다. 동의하기 전에 AdMob API에 액세스할 수 있는 Google 계정으로 로그인했는지 확인하세요. 애플리케이션은 현재 로그인되어 있는 계정을 대신하여 데이터에 액세스하도록 승인됩니다.
인증 및 승인에는 Google OAuth 2.0을 사용하는 간단한 명령줄 도구인 oauth2l을 사용하는 것이 좋습니다. oauth2l을 설치하고 아래 명령어를 실행합니다. 이때 path_to_credentials_json를 클라우드 애플리케이션을 등록할 때 다운로드하는 credentials.json
파일의 경로로 바꿉니다. 처음 실행 시 명령어를 통해 OAuth 2.0 승인 절차가 진행됩니다. 후속 실행에서는 토큰이 자동으로 새로고침됩니다.
oauth2l header --json path_to_credentials_json --scope admob.readonly,admob.monetization
광고 소스를 나열합니다.
pub-XXXXXXXXXXXXXXXX를 게시자 ID로 대체하여 AdMob 광고 소스 정보를 가져옵니다. 게시자 ID를 찾는 방법은 안내를 참고하세요.
curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources \
-H "$(oauth2l header --json path_to_credentials_json --scope admob.readonly)"
샘플 응답:
{
"adSources": [
{
"name": "accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855",
"adSourceId": "5450213213286189855",
"title": "AdMob Network",
}
]
}
어댑터를 나열합니다.
SSSSSSSSSSSSSSSSSSSS를 관심 있는 어댑터의 광고 소스 ID로 바꿉니다.
다음 명령어를 사용하여 어댑터 목록을 가져옵니다.
curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources/SSSSSSSSSSSSSSSSSSSS/adapters \
-H "$(oauth2l header --json path_to_credentials_json --scope admob.readonly)"
ID가 5450213213286189855
인 AdMob 네트워크 광고 소스의 샘플 응답은 다음과 같습니다.
{
"adapters": [
{
"name": "accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855/adapters/1",
"adapterId": "1",
"title": "AdMob Network Android SDK",
"platform": "ANDROID",
"formats": ["BANNER", "INTERSTITIAL",
"REWARDED", "NATIVE", "REWARDED_INTERSTITIAL", "APP_OPEN"],
"adapterConfigMetadata": [{
"adapterConfigMetadataId": "118",
"adapterConfigMetadataLabel": "Ad unit ID"
}]
},
{
"name": "accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855/adapters/2",
"adapterId": "2",
"title": "AdMob Network iOS SDK",
"platform": "ANDROID",
"formats": ["BANNER", "INTERSTITIAL",
"REWARDED", "NATIVE", "REWARDED_INTERSTITIAL", "APP_OPEN"],
"adapterConfigMetadata": [{
"adapterConfigMetadataId": "119",
"adapterConfigMetadataLabel": "Ad unit ID"
}]
}]
}
광고 단위 매핑을 만듭니다.
YYYYYYYYYY를 광고 단위 ID 프래그먼트로 바꿉니다. 광고 단위 ID 프래그먼트는 'ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY' 형식의 광고 단위 ID의 마지막 10자리입니다. 광고 단위 ID를 찾는 방법에 관한 안내를 참고하세요.
curl --http1.0 -X POST \
https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings \
-H "$(oauth2l header --json path_to_credentials_json --scope admob.monetization)" \
-H "Content-Type: application/json" --data @- << EOF
{
"name": "InMobi ad unit mapping",
"adapterId": "8",
"adUnitConfigurations": {
"174": "inMobiAccountId",
"176": "inMobiPlacementId"
}
}
EOF
모든 광고 단위 매핑을 나열합니다.
YYYYYYYYYY를 광고 단위 ID 프래그먼트로 바꿉니다. 광고 단위 ID 프래그먼트는 'ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY' 형식의 광고 단위 ID에서 마지막 10자리입니다. 광고 단위 ID를 찾는 방법을
참고하세요.
curl --http1.0 -X GET \
https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings \
-H "$(oauth2l header --json path_to_credentials_json --scope admob.readonly)"
{
"adUnitMappingName":
"accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings/ZZZZZZZZZZ"
{
"adapterId": "1",
"state": "ENABLED",
"adUnitConfigurations": {
"adUnitMappingConfigurationKey": "adUnitId",
"adUnitMappingConfigurationValue": "118",
}
}
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eAd unit mappings link your AdMob ad units to third-party ad networks, allowing them to request ads from those networks.\u003c/p\u003e\n"],["\u003cp\u003eThese mappings are crucial for mediation groups, directing specific ad units to make requests from external ad sources.\u003c/p\u003e\n"],["\u003cp\u003eUnlike the AdMob UI, you must create and manage ad unit mappings separately through the AdMob API.\u003c/p\u003e\n"],["\u003cp\u003eOnce created, you can utilize these mappings when establishing or modifying mediation group lines.\u003c/p\u003e\n"],["\u003cp\u003eYou can get started with AdMob API by creating OAuth 2.0 credentials and generating authorization credentials using your client secret file.\u003c/p\u003e\n"]]],["Ad unit mappings are configured settings for third-party ad networks. They are created independently of mediation groups and their lines, and are used as parameters within those lines to facilitate ad requests. To use, first generate OAuth 2.0 credentials. Then, list ad sources and adapters, obtain the ad unit ID fragment, and create the ad unit mapping via a POST request. Finally, list the newly created mapping via a GET request.\n"],null,["# Ad unit mappings are third-party configuration settings that map to an AdMob ad\nunit and enable it to make an ad request to a third-party ad network.\n\nWhen creating a mediation group, ad unit mappings are used as a parameter for\neach [mediation group line](/admob/api/reference/rest/v1beta/accounts.mediationGroups)\nas settings for the specified ad unit to make third-party ad network requests.\nUnlike on the AdMob UI, ad unit mappings need to be [created](/admob/api/reference/rest/v1beta/accounts.adUnits.adUnitMappings/create)\nindependently outside of mediation groups and mediation group lines.\nAfter creation, you can [list](/admob/api/reference/rest/v1beta/accounts.adUnits.adUnitMappings/list)\nall ad unit mappings and use them as a parameter when creating or updating\nmediation group lines with new ad unit mappings.\n\nExamples\n--------\n\nWith [OAuth 2.0 credentials created](/admob/api/v1/getting-started#credentials),\nyou're ready to start using the AdMob API. To request access using OAuth\n2.0, your application will also need the scope information.\n\nHere's the OAuth 2.0 scope information:\n\n\u003cbr /\u003e\n\n| Scope | Meaning |\n|------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `https://www.googleapis.com/auth/admob.monetization` | See, create, and edit your AdMob monetization settings. |\n| `https://www.googleapis.com/auth/admob.readonly` | See all AdMob data. This may include account information, inventory and mediation settings, reports, and other data. This doesn't include sensitive data, such as payments or campaign details. |\n\n\u003cbr /\u003e\n\nGet started on creating your first ad unit mapping: \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 credentials.\n\n The first time you perform this step you'll be 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 application will be authorized to access data on behalf of whichever\n account is 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\n command below, replacing \u003cvar translate=\"no\"\u003epath_to_credentials_json\u003c/var\u003e with a path\n to a `credentials.json` file that you download when registering your\n cloud application. For the first run, the command walks you through the\n OAuth 2.0 authorization flow. Subsequent runs refresh the token\n automatically. \n\n ```\n oauth2l header --json path_to_credentials_json --scope admob.readonly,admob.monetization\n ```\n2. List ad sources.\n\n Get AdMob ad source information by replacing \u003cvar translate=\"no\"\u003epub-XXXXXXXXXXXXXXXX\u003c/var\u003e\n with your publisher ID. See the\n [instructions](//support.google.com/admob/answer/2784578) on how to find\n your publisher ID. \n\n ```\n curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.readonly)\"\n ```\n\n Sample response: \n\n ```text\n {\n \"adSources\": [\n {\n \"name\": \"accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855\",\n \"adSourceId\": \"5450213213286189855\",\n \"title\": \"AdMob Network\",\n }\n ]\n }\n ```\n3. List the adapters.\n\n Replace \u003cvar translate=\"no\"\u003eSSSSSSSSSSSSSSSSSSSS\u003c/var\u003e with the ad source ID for the\n adapters of interest.\n\n Use the following command to get a list of adapters: \n\n ```\n curl --http1.0 -X GET https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adSources/SSSSSSSSSSSSSSSSSSSS/adapters \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.readonly)\"\n ```\n\n Sample response for the AdMob Network ad source with ID\n `5450213213286189855`: \n\n ```scdoc\n {\n \"adapters\": [\n {\n \"name\": \"accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855/adapters/1\",\n \"adapterId\": \"1\",\n \"title\": \"AdMob Network Android SDK\",\n \"platform\": \"ANDROID\",\n \"formats\": [\"BANNER\", \"INTERSTITIAL\",\n \"REWARDED\", \"NATIVE\", \"REWARDED_INTERSTITIAL\", \"APP_OPEN\"],\n \"adapterConfigMetadata\": [{\n \"adapterConfigMetadataId\": \"118\",\n \"adapterConfigMetadataLabel\": \"Ad unit ID\"\n }]\n },\n {\n \"name\": \"accounts/pub-XXXXXXXXXXXXXXXX/adSources/5450213213286189855/adapters/2\",\n \"adapterId\": \"2\",\n \"title\": \"AdMob Network iOS SDK\",\n \"platform\": \"ANDROID\",\n \"formats\": [\"BANNER\", \"INTERSTITIAL\",\n \"REWARDED\", \"NATIVE\", \"REWARDED_INTERSTITIAL\", \"APP_OPEN\"],\n \"adapterConfigMetadata\": [{\n \"adapterConfigMetadataId\": \"119\",\n \"adapterConfigMetadataLabel\": \"Ad unit ID\"\n }]\n }]\n }\n ```\n4. Create an ad unit mapping.\n\n Replace \u003cvar translate=\"no\"\u003eYYYYYYYYYY\u003c/var\u003e with your ad unit ID fragment. The ad unit\n ID fragment is the last 10 digits of your ad unit ID which follows\n the format \"ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY\". See instructions to\n [find your ad unit ID](//support.google.com/admob/answer/7356431). \n\n ```\n curl --http1.0 -X POST \\\n https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.monetization)\" \\\n -H \"Content-Type: application/json\" --data @- \u003c\u003c EOF\n {\n \"name\": \"InMobi ad unit mapping\",\n \"adapterId\": \"8\",\n \"adUnitConfigurations\": {\n \"174\": \"inMobiAccountId\",\n \"176\": \"inMobiPlacementId\"\n }\n }\n EOF\n ```\n5. List all ad unit mappings.\n\n Replace \u003cvar translate=\"no\"\u003eYYYYYYYYYY\u003c/var\u003e with your ad unit ID fragment. The ad unit\n ID fragment is the last 10 digits of your ad unit ID from\n the format \"ca-app-pub-XXXXXXXXXXXXXXXX/YYYYYYYYYY\". See instructions to\n [find your ad unit ID](//support.google.com/admob/answer/7356431). \n\n ```\n curl --http1.0 -X GET \\\n https://admob.googleapis.com/v1beta/accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings \\\n -H \"$(oauth2l header --json path_to_credentials_json --scope admob.readonly)\"\n ``` \n\n ```text\n {\n \"adUnitMappingName\":\n \"accounts/pub-XXXXXXXXXXXXXXXX/adUnits/YYYYYYYYYY/adUnitMappings/ZZZZZZZZZZ\"\n {\n \"adapterId\": \"1\",\n \"state\": \"ENABLED\",\n \"adUnitConfigurations\": {\n \"adUnitMappingConfigurationKey\": \"adUnitId\",\n \"adUnitMappingConfigurationValue\": \"118\",\n }\n }\n }\n ```"]]