ধাপ 3: আপনার অ্যাপের কোডে রিমোট কনফিগ প্যারামিটার মানগুলি পরিচালনা করুন
ভূমিকা: Firebase ব্যবহার করে নতুন AdMob বিজ্ঞাপন ফর্ম্যাট গ্রহণের পরীক্ষা করুন |
ধাপ 1: পরীক্ষার জন্য একটি নতুন বিজ্ঞাপন ইউনিট ভেরিয়েন্ট তৈরি করতে AdMob ব্যবহার করুন |
ধাপ 2: Firebase কনসোলে একটি A/B পরীক্ষা সেট আপ করুন |
ধাপ 3: আপনার অ্যাপের কোডে রিমোট কনফিগ প্যারামিটার মানগুলি পরিচালনা করুন |
ধাপ 4: A/B পরীক্ষা শুরু করুন এবং Firebase কনসোলে পরীক্ষার ফলাফল পর্যালোচনা করুন |
ধাপ 5: নতুন বিজ্ঞাপন বিন্যাস রোল আউট করার সিদ্ধান্ত নিন |
শেষ ধাপের শেষে, আপনি একটি রিমোট কনফিগ প্যারামিটার তৈরি করেছেন ( SHOW_NEW_AD_KEY
)। এই ধাপে, সেই প্যারামিটারের মানের উপর ভিত্তি করে আপনার অ্যাপটি কী প্রদর্শন করবে তার জন্য আপনি আপনার অ্যাপের কোডে যুক্তি যোগ করবেন — true
(নতুন বিজ্ঞাপন দেখান) বনাম false
(নতুন বিজ্ঞাপনটি দেখাবেন না )।
প্রয়োজনীয় SDK যোগ করুন
আপনার অ্যাপ্লিকেশন কোডে রিমোট কনফিগ ব্যবহার করার আগে, আপনার প্রোজেক্ট বিল্ড ফাইলগুলিতে Google Analytics-এর জন্য রিমোট কনফিগ SDK এবং Firebase SDK উভয়ই যোগ করুন।
সুইফট
আপনার পডফাইলে নিম্নলিখিত পড যোগ করুন এবং ইনস্টল করুন:
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Analytics'
pod 'Firebase/RemoteConfig'
উদ্দেশ্য গ
আপনার পডফাইলে নিম্নলিখিত পড যোগ করুন এবং ইনস্টল করুন:
pod 'Google-Mobile-Ads-SDK'
pod 'Firebase/Analytics'
pod 'Firebase/RemoteConfig'
Java
আপনার build.gradle
ফাইলে নিম্নলিখিত লাইব্রেরি নির্ভরতা যোগ করুন:
implementation 'com.google.android.gms:play-services-ads:22.1.0'
implementation 'com.google.firebase:firebase-analytics:21.3.0'
implementation 'com.google.firebase:firebase-config:21.4.0'
Kotlin+KTX
আপনার build.gradle
ফাইলে নিম্নলিখিত লাইব্রেরি নির্ভরতা যোগ করুন:
implementation 'com.google.android.gms:play-services-ads:22.1.0'
implementation 'com.google.firebase:firebase-analytics-ktx:21.3.0'
implementation 'com.google.firebase:firebase-config-ktx:21.4.0'
ঐক্য
Firebase ইউনিটি SDK ডাউনলোড এবং ইনস্টল করুন, তারপর আপনার প্রকল্পে নিম্নলিখিত ইউনিটি প্যাকেজগুলি যোগ করুন:
-
FirebaseAnalytics.unitypackage
-
FirebaseRemoteConfig.unitypackage
দূরবর্তী কনফিগার উদাহরণ কনফিগার করুন
রিমোট কনফিগ প্যারামিটার মান ব্যবহার করতে, রিমোট কনফিগার ইনস্ট্যান্স কনফিগার করুন যাতে এটি ক্লায়েন্ট অ্যাপ ইনস্ট্যান্সের জন্য নতুন মান আনতে সেট আপ হয়।
এই উদাহরণে, রিমোট কনফিগার প্রতি ঘন্টায় একবার নতুন প্যারামিটার মান পরীক্ষা করার জন্য কনফিগার করা হয়েছে।
সুইফট
remoteConfig = RemoteConfig.remoteConfig()
let settings = RemoteConfigSettings()
settings.minimumFetchInterval = 3600
remoteConfig.configSettings = settings
উদ্দেশ্য গ
self.remoteConfig = [FIRRemoteConfig remoteConfig];
FIRRemoteConfigSettings *remoteConfigSettings = [[FIRRemoteConfigSettings alloc] init];
remoteConfigSettings.minimumFetchInterval = 3600;
self.remoteConfig.configSettings = remoteConfigSettings;
Java
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder()
.setMinimumFetchIntervalInSeconds(3600)
.build();
mFirebaseRemoteConfig.setConfigSettingsAsync(configSettings);
Kotlin+KTX
remoteConfig = Firebase.remoteConfig
val configSettings = remoteConfigSettings {
minimumFetchIntervalInSeconds = 3600
}
remoteConfig.setConfigSettingsAsync(configSettings)
ঐক্য
var remoteConfig = FirebaseRemoteConfig.DefaultInstance;
var configSettings = new ConfigSettings {
MinimumFetchInternalInMilliseconds =
(ulong)(new TimeSpan(1, 0, 0).TotalMilliseconds)
};
remoteConfig.SetConfigSettingsAsync(configSettings)
.ContinueWithOnMainThread(task => {
Debug.Log("Config settings confirmed");
}
রিমোট কনফিগারেশন আনুন এবং সক্রিয় করুন
রিমোট কনফিগ প্যারামিটার আনুন এবং সক্রিয় করুন যাতে এটি নতুন প্যারামিটার মান ব্যবহার করা শুরু করতে পারে।
আপনি আপনার অ্যাপের লোডিং পর্যায়ে যত তাড়াতাড়ি সম্ভব এই কলটি করতে চাইবেন কারণ এই কলটি অ্যাসিঙ্ক্রোনাস এবং আপনার রিমোট কনফিগার মানটি আগে থেকে আনতে হবে যাতে আপনার অ্যাপ বিজ্ঞাপনটি দেখাতে পারে কিনা তা জানতে পারে৷
সুইফট
remoteConfig.fetch() { (status, error) -> Void in
if status == .success {
print("Config fetched!")
self.remoteConfig.activate() { (changed, error) in
// ...
}
} else {
print("Config not fetched")
print("Error: \(error?.localizedDescription ?? "No error available.")")
}
self.loadAdUnit()
}
উদ্দেশ্য গ
[self.remoteConfig fetchWithCompletionHandler:^(FIRRemoteConfigFetchStatus status, NSError *error) {
if (status == FIRRemoteConfigFetchStatusSuccess) {
NSLog(@"Config fetched!");
[self.remoteConfig activateWithCompletion:^(BOOL changed, NSError * _Nullable error) {
// ...
}];
} else {
NSLog(@"Config not fetched");
NSLog(@"Error %@", error.localizedDescription);
}
[self loadAdUnit];
}];
Java
mFirebaseRemoteConfig.fetchAndActivate()
.addOnCompleteListener(this, new OnCompleteListener<Boolean>() {
@Override
public void onComplete(@NonNull Task<Boolean> task) {
if (task.isSuccessful()) {
boolean updated = task.getResult();
Log.d(TAG, "Config params updated: " + updated);
} else {
Log.d(TAG, "Config params failed to update");
}
loadAdUnit();
}
});
Kotlin+KTX
remoteConfig.fetchAndActivate()
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
val updated = task.result
Log.d(TAG, "Config params updated: $updated")
} else {
Log.d(TAG, "Config params failed to update")
}
loadAdUnit()
}
ঐক্য
remoteConfig.FetchAndActivateAsync().ContinueWithOnMainThread(task => {
if (task.IsFaulted) {
Debug.LogWarning("Config params failed to update");
} else {
Debug.Log("Config params updated: " + task.Result);
}
LoadAdUnit();
});
আপনার অ্যাপ এখন এই টিউটোরিয়ালের আগে সেট আপ করা A/B পরীক্ষার সময় তৈরি করা রিমোট কনফিগ প্যারামিটারটি পরিচালনা করার জন্য প্রস্তুত।
রিমোট কনফিগারেশন প্যারামিটার মান ব্যবহার করুন
নতুন পুরস্কৃত ইন্টারস্টিশিয়াল বিজ্ঞাপন ইউনিট অ্যাপ ইনস্ট্যান্স ( true
false
মান) দেখাবে কি না (ফলের প্যারামিটার মান) দেখাবে কিনা তা নির্ধারণ করতে loadAdUnit()
ফাংশনে প্রি-ফেচ করা রিমোট কনফিগার মান ব্যবহার করুন।
সুইফট
private func loadAdUnit() {
let showNewAdFormat = remoteConfig["users"].boolValue
if showNewAdFormat {
// Load Rewarded Interstitial Ad.
// This should load your new implemented ad unit
// as per AdMob instructions (the first step of this tutorial).
} else {
// Show the existing ad unit.
}
}
উদ্দেশ্য গ
- (void)loadAdUnit {
BOOL showAds = self.remoteConfig[@"SHOW_NEW_AD_KEY"].boolValue;
if (showAds) {
// Load Rewarded Interstitial Ad.
// This should load your new implemented ad unit
// per AdMob instructions (the first step of this tutorial).
} else {
// Show the existing ad unit.
}
}
Java
private void loadAdUnit() {
boolean showNewAdFormat =
mFirebaseRemoteConfig.getBoolean(SHOW_NEW_AD_KEY);
if (showNewAdFormat) {
// Load Rewarded Interstitial Ad.
// This should load your new implemented ad unit
// per AdMob instructions (the first step of this tutorial).
} else {
// Show the existing ad unit.
}
}
Kotlin+KTX
private fun loadAdUnit() {
var showNewAdFormat = remoteConfig.getBoolean(SHOW_NEW_AD_KEY)
if (showNewAdFormat) {
// Load Rewarded Interstitial Ad.
// This should load your new implemented ad unit
// per AdMob instructions (the first step of this tutorial).
} else {
// Show the existing ad unit.
}
}
ঐক্য
void LoadAdUnit() {
bool showNewAdFormat =
remoteConfig.GetValue("SHOW_NEW_AD_KEY").BooleanValue;
if (showNewAdFormat) {
// Load Rewarded Interstitial Ad (new implemented ad unit)
// per AdMob instructions (the first step of this tutorial).
} else {
// Show the existing ad unit.
}
}
পরামিতি মান জন্য অন্যান্য চেক যোগ করুন
আপনার অ্যাপ্লিকেশন কোডের অন্যান্য ক্ষেত্র রয়েছে যেখানে কোন বিজ্ঞাপন অভিজ্ঞতা লোড হবে তা নির্ধারণ করতে আপনাকে এই রিমোট কনফিগার প্যারামিটারের মান পরীক্ষা করতে হবে। উদাহরণস্বরূপ, ব্যবহারকারী বর্তমানটি দেখা শেষ করার পরে আপনি একটি বিজ্ঞাপন পুনরায় লোড করবেন কিনা তা নির্ধারণ করতে পারেন৷
যেকোনো প্যারামিটার মান পরিবর্তনের জন্য কল আনতে এবং সক্রিয় করতে প্রথমে করা উচিত — উদাহরণস্বরূপ, আপনি যদি একটি নতুন পরীক্ষা শেষ করার বা তৈরি করার সিদ্ধান্ত নেন।
সেখান থেকে, আপনি সর্বদা নিম্নলিখিত কলগুলি ব্যবহার করে প্যারামিটারের মান পরীক্ষা করতে পারেন:
সুইফট
remoteConfig["showNewAdKey"].boolValue
উদ্দেশ্য গ
self.remoteConfig[@"SHOW_NEW_AD_KEY"].boolValue;
Java
mFirebaseRemoteConfig.getBoolean(SHOW_NEW_AD_KEY)
Kotlin+KTX
remoteConfig.getBoolean(SHOW_NEW_AD_KEY)
ঐক্য
remoteConfig.GetValue("SHOW_NEW_AD_KEY").BooleanValue
এই কলগুলি সর্বদা একটি অ্যাপ ইন্সট্যান্সের জন্য একই মান ফেরত দেবে এটি নিয়ন্ত্রণ গোষ্ঠী বা নতুন বিজ্ঞাপন ভেরিয়েন্ট গ্রুপে রাখা হয়েছে কিনা তার উপর নির্ভর করে, যদি না ফায়ারবেস কনসোলে কোনো পরিবর্তন করা হয় যা পূর্ববর্তী কলগুলিতে আনা এবং সক্রিয় করা হয়েছিল।
ধাপ 2 : ফায়ারবেস কনসোলে একটি A/B পরীক্ষা সেট আপ করুনধাপ 4 : A/B পরীক্ষা শুরু করুন এবং পরীক্ষার ফলাফল পর্যালোচনা