먼저 Ad Manager UI에서 맞춤 이벤트를 만들어야 합니다. 수익 그룹 만들기 및 관리의 안내를 참고하세요.
다음을 제공해야 합니다.
클래스 이름
맞춤 이벤트 어댑터를 구현하는 클래스의 정규화된 이름입니다(예:
SampleCustomEvent 또는 클래스가 Swift로 구현된 경우 MediationExample.SampleCustomEventSwift).
프로젝트에 대상이 여러 개 있거나 프로젝트 이름이 대상 이름과 다른 경우 대상 이름이 필요합니다. 대상 이름은 appName_targetName.className과 같이 표시됩니다. 또한 영숫자 문자가 아닌 대시 등의 문자는 밑줄로 바꿔야 합니다.
예
라벨
광고 소스를 정의하는 고유한 이름입니다.
매개변수
맞춤 이벤트 어댑터에 전달되는 문자열 인수(선택사항)입니다.
GADMediationAdapter 구현
맞춤 이벤트를 만드는 첫 번째 단계는 이 예의 SampleCustomEvent 클래스와 같이 GADMediationAdapter 프로토콜을 구현하는 것입니다.
Ad Manager로부터 메시지를 수신하고 올바른 광고 형식을 만드는 책임을 위임하는 것은 이 클래스의 책임입니다.
어댑터 초기화
Google 모바일 광고 SDK를 초기화하면 Ad Manager UI 내에서 앱용으로 구성되어 지원되는 모든 서드 파티 어댑터 및 맞춤 이벤트에서 setUpWithConfiguration:completionHandler:를 호출합니다. 이 메서드를 사용하여 맞춤 이벤트에 사용할 서드 파티 SDK에 필요한 설정 또는 초기화를 수행할 수 있습니다.
Swift
importGoogleMobileAdsclassSampleCustomEvent:NSObject,MediationAdapter{staticfuncsetUpWith(_configuration:MediationServerConfiguration,completionHandler:@escapingGADMediationAdapterSetUpCompletionBlock){// This is where you will initialize the SDK that this custom event is built// for. Upon finishing the SDK initialization, call the completion handler// with success.completionHandler(nil)}}
Objective-C
#import "SampleCustomEvent.h"@implementationSampleCustomEvent+(void)setUpWithConfiguration:(nonnullGADMediationServerConfiguration*)configurationcompletionHandler:(nonnullGADMediationAdapterSetUpCompletionBlock)completionHandler{// This is where you initialize the SDK that this custom event is built// for. Upon finishing the SDK initialization, call the completion handler// with success.completionHandler(nil);}
버전 번호 보고
모든 맞춤 이벤트는 맞춤 이벤트 어댑터의 자체 버전과 맞춤 이벤트 인터페이스가 있는 서드 파티 SDK의 버전을 모두 Google 모바일 광고 SDK에 보고해야 합니다. 버전은
GADVersionNumber
객체로 보고됩니다.
[[["이해하기 쉬움","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-08-23(UTC)"],[[["\u003cp\u003eCustom events allow you to add waterfall mediation for unsupported ad networks by implementing a custom event adapter.\u003c/p\u003e\n"],["\u003cp\u003eBefore creating custom events, you must integrate an ad format (Banner, Interstitial, Native, or Rewarded) into your app.\u003c/p\u003e\n"],["\u003cp\u003eA custom event needs to be created in the Ad Manager UI, requiring a Class Name, Label, and optional Parameter.\u003c/p\u003e\n"],["\u003cp\u003eYou must implement the \u003ccode\u003eGADMediationAdapter\u003c/code\u003e protocol to receive messages from Ad Manager and delegate ad creation responsibility.\u003c/p\u003e\n"],["\u003cp\u003eCustom events must report both the custom event adapter version and the third-party SDK version to the Google Mobile Ads SDK.\u003c/p\u003e\n"]]],[],null,["Custom events let you add waterfall mediation for an ad network that isn't a\n[supported ad network](/ad-manager/mobile-ads-sdk/ios/choose-networks). You do this by implementing\na custom event adapter for the ad network you want to integrate.\n\nPrerequisites\n\nBefore you can create custom events, you must first integrate one of the\nfollowing ad format into your app:\n\n- [Banner](/ad-manager/mobile-ads-sdk/ios/banner)\n- [Interstitial](/ad-manager/mobile-ads-sdk/ios/interstitial)\n- [Native](/ad-manager/mobile-ads-sdk/ios/native)\n- [Rewarded](/ad-manager/mobile-ads-sdk/ios/rewarded)\n\nCreate a custom event in the UI\n\nA custom event must first be created in the Ad Manager\nUI. See the instructions in\n\n[Create and manage yield\ngroups](//support.google.com/admanager/answer/7390828).\n\n\nYou need to supply the following:\n\nClass Name\n\n: The fully-qualified name of the class that implements the custom event\n adapter---for example,\n\n `SampleCustomEvent`; or if your class is implemented in Swift,\n `MediationExample.SampleCustomEventSwift`.\n\n Target name is required if you have multiple targets in your project or if\n the project name is different from the target name. With the target name, it\n would look like this: `appName_targetName.className`. In addition, remember\n to replace any non-alphanumeric characters such as dashes with underscores.\n [Example](//maximbilan.medium.com/ios-objective-c-project-nsclassfromstring-method-for-swift-classes-dbadb721723).\n\nLabel\n\n: A unique name defining the ad source.\n\nParameter\n\n: An optional string argument passed to your custom event adapter.\n\nImplement GADMediationAdapter\n\nThe first step to creating a custom event is implementing the\n`GADMediationAdapter` protocol as shown by the `SampleCustomEvent` class\nin [our example](//github.com/googleads/googleads-mobile-ios-mediation).\n\nIt is the responsibility of this class to receive messages from\nAd Manager and delegate the responsibility of creating\nthe correct ad format.\n\nInitialize the adapter\n\nWhen Google Mobile Ads SDK initializes,\n\n`setUpWithConfiguration:completionHandler:`\n\nis invoked on all supported third-party adapters and custom events configured\nfor the app within the Ad Manager UI. Use this method to\nperform any necessary setup or initialization on the required third-party SDK\nfor your custom event. \n\nSwift \n\n import GoogleMobileAds\n\n class SampleCustomEvent: NSObject, MediationAdapter {\n\n static func setUpWith(\n _ configuration: MediationServerConfiguration,\n completionHandler: @escaping GADMediationAdapterSetUpCompletionBlock\n ) {\n // This is where you will initialize the SDK that this custom event is built\n // for. Upon finishing the SDK initialization, call the completion handler\n // with success.\n completionHandler(nil)\n }\n }\n\nObjective-C \n\n #import \"SampleCustomEvent.h\"\n\n @implementation SampleCustomEvent\n\n + (void)setUpWithConfiguration:(nonnull GADMediationServerConfiguration *)configuration\n completionHandler:(nonnull GADMediationAdapterSetUpCompletionBlock)completionHandler {\n // This is where you initialize the SDK that this custom event is built\n // for. Upon finishing the SDK initialization, call the completion handler\n // with success.\n completionHandler(nil);\n }\n\nReport version numbers\n\nAll custom events must report to Google Mobile Ads SDK both the version of\nthe custom event adapter itself and the version of the third-party SDK the\ncustom event interfaces with. Versions are reported as\n\n[`GADVersionNumber`](/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADVersionNumber)\n\nobjects: \n\nSwift \n\n static func adSDKVersion() -\u003e VersionNumber {\n let versionComponents = String(SampleSDKVersion).components(\n separatedBy: \".\")\n\n if versionComponents.count \u003e= 3 {\n let majorVersion = Int(versionComponents[0]) ?? 0\n let minorVersion = Int(versionComponents[1]) ?? 0\n let patchVersion = Int(versionComponents[2]) ?? 0\n\n return VersionNumber(\n majorVersion: majorVersion, minorVersion: minorVersion, patchVersion: patchVersion)\n }\n\n return VersionNumber()\n }\n\n static func adapterVersion() -\u003e VersionNumber {\n let versionComponents = String(SampleAdSDK.SampleAdSDKVersionNumber).components(\n separatedBy: \".\")\n var version = VersionNumber()\n if versionComponents.count == 4 {\n version.majorVersion = Int(versionComponents[0]) ?? 0\n version.minorVersion = Int(versionComponents[1]) ?? 0\n version.patchVersion = Int(versionComponents[2]) * 100 + Int(versionComponents[3])\n }\n return version\n }\n\nObjective-C \n\n + (GADVersionNumber)adSDKVersion {\n NSArray *versionComponents =\n [SampleSDKVersion componentsSeparatedByString:@\".\"];\n GADVersionNumber version = {0};\n if (versionComponents.count \u003e= 3) {\n version.majorVersion = [versionComponents[0] integerValue];\n version.minorVersion = [versionComponents[1] integerValue];\n version.patchVersion = [versionComponents[2] integerValue];\n }\n return version;\n }\n\n + (GADVersionNumber)adapterVersion {\n NSArray *versionComponents =\n [SampleCustomEventAdapterVersion componentsSeparatedByString:@\".\"];\n GADVersionNumber version = {0};\n if (versionComponents.count == 4) {\n version.majorVersion = [versionComponents[0] integerValue];\n version.minorVersion = [versionComponents[1] integerValue];\n version.patchVersion = [versionComponents[2] integerValue] * 100 +\n [versionComponents[3] integerValue];\n }\n return version;\n }\n\nRequest ad\n\nTo request an ad, refer to the instructions specific to the ad format:\n\n- [Banner](/ad-manager/mobile-ads-sdk/ios/custom-events/banner)\n- [Interstitial](/ad-manager/mobile-ads-sdk/ios/custom-events/interstitial)\n- [Native](/ad-manager/mobile-ads-sdk/ios/custom-events/native)\n- [Rewarded](/ad-manager/mobile-ads-sdk/ios/custom-events/rewarded)"]]