সেটআপ
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
কাস্টম ইভেন্টগুলি আপনাকে একটি বিজ্ঞাপন নেটওয়ার্কের জন্য জলপ্রপাতের মধ্যস্থতা যোগ করতে দেয় যা একটি সমর্থিত বিজ্ঞাপন নেটওয়ার্ক নয়৷ আপনি যে বিজ্ঞাপন নেটওয়ার্কটি সংহত করতে চান তার জন্য একটি কাস্টম ইভেন্ট অ্যাডাপ্টার প্রয়োগ করে আপনি এটি করেন৷
আপনি আমাদের GitHub রেপোতে একটি সম্পূর্ণ নমুনা কাস্টম ইভেন্ট প্রকল্প খুঁজে পেতে পারেন।
পূর্বশর্ত
আপনি কাস্টম ইভেন্ট তৈরি করার আগে, আপনাকে প্রথমে আপনার অ্যাপে নিম্নলিখিত বিজ্ঞাপন বিন্যাসগুলির মধ্যে একটিকে সংহত করতে হবে:
UI এ একটি কাস্টম ইভেন্ট তৈরি করুন
AdMob UI-তে প্রথমে একটি কাস্টম ইভেন্ট তৈরি করতে হবে। একটি কাস্টম ইভেন্ট যোগ করুন -এ নির্দেশাবলী দেখুন।
আপনাকে নিম্নলিখিত সরবরাহ করতে হবে:
- ক্লাসের নাম
ক্লাসের সম্পূর্ণ-যোগ্য নাম যা কাস্টম ইভেন্ট অ্যাডাপ্টার প্রয়োগ করে—উদাহরণস্বরূপ, SampleCustomEvent
; অথবা যদি আপনার ক্লাস Swift, MediationExample.SampleCustomEventSwift
এ প্রয়োগ করা হয়।
আপনার প্রোজেক্টে একাধিক টার্গেট থাকলে বা প্রজেক্টের নাম টার্গেট নামের থেকে আলাদা হলে টার্গেট নাম প্রয়োজন। টার্গেট নামের সাথে, এটি দেখতে এইরকম হবে: appName_targetName.className
। উপরন্তু, আন্ডারস্কোর দিয়ে ড্যাশের মতো অ-আলফানিউমেরিক অক্ষর প্রতিস্থাপন করতে ভুলবেন না। উদাহরণ
- লেবেল
বিজ্ঞাপনের উৎসকে সংজ্ঞায়িত করে একটি অনন্য নাম।
- প্যারামিটার
আপনার কাস্টম ইভেন্ট অ্যাডাপ্টারের কাছে একটি ঐচ্ছিক স্ট্রিং আর্গুমেন্ট পাস হয়েছে৷
একটি কাস্টম ইভেন্ট তৈরি করার প্রথম ধাপ হল GADMediationAdapter
প্রোটোকল প্রয়োগ করা যা আমাদের উদাহরণে SampleCustomEvent
ক্লাস দ্বারা দেখানো হয়েছে।
AdMob থেকে বার্তা পাওয়া এবং সঠিক বিজ্ঞাপন বিন্যাস তৈরি করার দায়িত্ব অর্পণ করা এই শ্রেণীর দায়িত্ব।
অ্যাডাপ্টার শুরু করুন
যখন Google Mobile Ads SDK শুরু হয়, setUpWithConfiguration:completionHandler:
সমস্ত সমর্থিত থার্ড-পার্টি অ্যাডাপ্টার এবং AdMob UI-এর মধ্যে অ্যাপের জন্য কনফিগার করা কাস্টম ইভেন্টগুলিতে আহ্বান করা হয়। আপনার কাস্টম ইভেন্টের জন্য প্রয়োজনীয় থার্ড-পার্টি SDK-তে যেকোনো প্রয়োজনীয় সেটআপ বা আরম্ভ করার জন্য এই পদ্ধতিটি ব্যবহার করুন।
সুইফট
import GoogleMobileAds
class SampleCustomEvent: NSObject, MediationAdapter {
static func setUpWith(
_ configuration: MediationServerConfiguration,
completionHandler: @escaping GADMediationAdapterSetUpCompletionBlock
) {
// 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)
}
}
উদ্দেশ্য-C
#import "SampleCustomEvent.h"
@implementation SampleCustomEvent
+ (void)setUpWithConfiguration:(nonnull GADMediationServerConfiguration *)configuration
completionHandler:(nonnull GADMediationAdapterSetUpCompletionBlock)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
অবজেক্ট হিসাবে রিপোর্ট করা হয়েছে:
সুইফট
static func adSDKVersion() -> VersionNumber {
let versionComponents = String(SampleSDKVersion).components(
separatedBy: ".")
if versionComponents.count >= 3 {
let majorVersion = Int(versionComponents[0]) ?? 0
let minorVersion = Int(versionComponents[1]) ?? 0
let patchVersion = Int(versionComponents[2]) ?? 0
return VersionNumber(
majorVersion: majorVersion, minorVersion: minorVersion, patchVersion: patchVersion)
}
return VersionNumber()
}
static func adapterVersion() -> VersionNumber {
let versionComponents = String(SampleAdSDK.SampleAdSDKVersionNumber).components(
separatedBy: ".")
var version = VersionNumber()
if versionComponents.count == 4 {
version.majorVersion = Int(versionComponents[0]) ?? 0
version.minorVersion = Int(versionComponents[1]) ?? 0
version.patchVersion = Int(versionComponents[2]) * 100 + Int(versionComponents[3])
}
return version
}
উদ্দেশ্য-C
+ (GADVersionNumber)adSDKVersion {
NSArray *versionComponents =
[SampleSDKVersion componentsSeparatedByString:@"."];
GADVersionNumber version = {0};
if (versionComponents.count >= 3) {
version.majorVersion = [versionComponents[0] integerValue];
version.minorVersion = [versionComponents[1] integerValue];
version.patchVersion = [versionComponents[2] integerValue];
}
return version;
}
+ (GADVersionNumber)adapterVersion {
NSArray *versionComponents =
[SampleCustomEventAdapterVersion componentsSeparatedByString:@"."];
GADVersionNumber version = {0};
if (versionComponents.count == 4) {
version.majorVersion = [versionComponents[0] integerValue];
version.minorVersion = [versionComponents[1] integerValue];
version.patchVersion = [versionComponents[2] integerValue] * 100 +
[versionComponents[3] integerValue];
}
return version;
}
অনুরোধ বিজ্ঞাপন
একটি বিজ্ঞাপনের অনুরোধ করতে, বিজ্ঞাপন বিন্যাসের জন্য নির্দিষ্ট নির্দেশাবলী পড়ুন:
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-09-03 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-09-03 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 defined in the AdMob 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 AdMob and delegate ad format creation.\u003c/p\u003e\n"],["\u003cp\u003eThe adapter needs to be initialized, report version numbers, and request ads following format-specific instructions.\u003c/p\u003e\n"]]],["Custom events enable adding waterfall mediation for unsupported ad networks by implementing a custom event adapter. First, create the custom event in the AdMob UI, supplying a class name, label, and optional parameter. Implement the `GADMediationAdapter` protocol, including the `setUpWithConfiguration` method for SDK initialization. Report the custom event adapter and third-party SDK versions using `GADVersionNumber`. Finally, refer to ad format-specific instructions to request an ad. This is all handled in a custom event class.\n"],null,["Custom events let you add waterfall mediation for an ad network that isn't a\n[supported ad network](/admob/ios/choose-networks). You do this by implementing\na custom event adapter for the ad network you want to integrate.\n\nYou can find a full sample custom event project in our [GitHub\nrepo](//github.com/googleads/googleads-mobile-android-mediation).\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](/admob/ios/banner)\n- [Interstitial](/admob/ios/interstitial)\n- [Native](/admob/ios/native)\n- [Rewarded](/admob/ios/rewarded)\n\nCreate a custom event in the UI\n\nA custom event must first be created in the AdMob\nUI. See the instructions in\n\n[Add a custom event](//support.google.com/admob/answer/3083407).\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\nAdMob 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 AdMob 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`](/admob/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](/admob/ios/custom-events/banner)\n- [Interstitial](/admob/ios/custom-events/interstitial)\n- [Native](/admob/ios/custom-events/native)\n- [Rewarded](/admob/ios/custom-events/rewarded)"]]