AB Testing Module

A/B Testing Module lets our studios to easily create custom A/B testing variants and it also contains default A/B testing variants that we can run a test on and optimize for each game by default. This module will affect the way the other modules work. At the moment we are using Firebase Remote SDK for running A/B tests and to fetch game-specific remote config that contains default values of these variants. Coda SDK supports 5 primitive types of variants which are int, string, float, long, and bool types.

Default A/B Testing Variants

Default A/B Testing variants are predefined variants that are being used internally by the Coda SDK. Coda SDK will use the values of these variants in order to execute certain module procedures such as showing an interstitial ad.

🚧

How to make default variants editable by remote config

Default A/B Testing variants have to be declared on Firebase Remote Dashboard otherwise they will just be using their default values defined inside SDK for all games.

📘

Default A/B Testing Variant Handling

We currently have 36 default variants that are defined in Coda SDK by default and they are being used internally. Default A/B Testing variants that are listed below are handled automatically by the Coda SDK except for the excludedLevels. You do not need to write any additional code to handle these variants except for the excludedLevels.

Variant Name

Variant Type

Default Value

Key & Description

Skip After Rewarded

bool

true

skipAfterRewarded:
When set to true interstitial ads will not be shown after a level where user has watched a rewarded Ad. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Use Banner Autorefresh

bool

true

useBannerAutorefresh:
Decides wether the SDK uses MoPub's auto refresh feature for Banner Ads or not.

Notification Active

bool

false

notificationActive:
Toggles the Notification Module.
If that value is false, no notifications will be scheduled by the client.

Show Coda Consent Dialog

bool

true

showCodaConsentFirst:
In-game Coda consent dialog will be shown before the native iOS consent popup if this value is true.

Show Simulated Native Consent Popup

bool

false

shouldShowFakeNativePopUp:
A simulated Native iOS consent popup will be shown if this value is true.
Note that the native popup always shows up after the in-game one if that one is also toggled on.

Show Interstitials Instead of Rewarded Ads

bool

false

showInterstitialInsteadOfRewarded:
When this toggle is on, SDK places an Interstitial ad instead of a Rewarded Ad when no Rewarded Ad is ready to show.

Use ML Configs

bool

false

useMLConfigs:
SDK uses calculated ML Model Configurations instead of the remote variables in Interstitial Ad Rules when this value is true.

Currently, only the Ad Tolerator Model is used, and the rule values are taken from the following two remote variables respectively:

mlAdToleratorTrue
and
mlAdToleratorFalse

Local Time Notification Active

bool

true

localTimeNotificationActive: decides whether to use local time based notifications or not. If set to false then delayed notifications will be used.

Skip Interstitial Below Progress

float

0.0f

skipInterstitialBelowProgress:
Set a value between 0 to 1 where 0 means start of the level and 1 means end of the level in terms of progress. This value will determine if showing of an interstitial ad should be skipped when user fails the level below this progress ratio. For example if you set this value to 0.5, Interstitial ads will only be shown if user passes half of the level. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Banner Refresh Interval

float

30f

bannerRefreshInterval:
Indicates the time between two banner requests in seconds after a successful Banner impression is made.

Delay Seconds After Level Fail

float

0f

delaySecondsAfterLevelFail:
This number is used to decide whether an interstitial ad should be delayed after a level fail. If the seconds between an interstitial is triggered and the last level fail before that is less than this number, the interstitial will be delayed.

Max Interstitial Per Session

int

10000

maxInterstitialPerSession:
Maximum number of interstitial that a player can see in one session. A session ends if player closes or pauses the game for more than 10 minutes. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Max Interstitials Per Day

int

10000

maxInterstitialsPerDay:
Maximum number of interstitial that a player can see in one day. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Interstitial Ad Frequency

int

-1

interstitialAdFrequency:
This number indicates the number of core game cycles that are needed to show an Interstitial ad. Setting this value to 2 means we will skip showing interstitial ads for next 2 levels after player sees one. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Interstitial After Level

int

0

interstitialAfterLevel:
This number indicates after which level Interstitial ads will become available. Set this value to 5 to start seeing interstitial after level 5. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Seconds Before First Interstitial

int

25

secondsBeforeFirstInterstitial:
This number indicates how many seconds Coda SDK will wait before being able to show first interstitial of the current session. settings this number to 5 means we will show first interstitial if 5 seconds passed after the session start. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Seconds Before First Interstitial First Session

int

25

secondsBeforeFirstInterstitialFirstSession:
This number indicates how many seconds Coda SDK will wait before being able to show first ever interstitial for the game. settings this number to 5 means we will show first ever interstitial if 5 seconds passed after the first run of the game. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Seconds Needed For Next Interstitial

int

25

secondsNeededForNextInterstitial:
This number indicates how many seconds that player will not be seeing another interstitial after seeing one. Settings this number to 25 means player will not be seeing any interstitial for the next 25 seconds. This value will be used internally by Advertisement Module ShowInterstitialAd() function as an ad ruleset.

Seconds Before Loading First Interstitial

int

5

secondsBeforeLoadingFirstInterstitial:
This number indicates how many seconds Coda SDK will wait before requesting the first interstitial of the session from Mopub. This value will be used internally by Advertisement Module ad requesting procedures

Seconds Before Loading Next Interstitial

int

5

secondsBeforeLoadingNextInterstitial:
This number indicates how many seconds Coda SDK will wait before requesting another interstitial from Mopub after user sees the previous one in a session. This value will be used internally by Advertisement Module ad requesting procedures

Seconds Before Loading First Rewarded

int

5

secondsBeforeLoadingFirstRewarded:
This number indicates how many seconds Coda SDK will wait before requesting the first rewarded ad of the session from Mopub. This value will be used internally by Advertisement Module ad requesting procedures

Seconds Before Loading Next Rewarded

int

5

secondsBeforeLoadingNextRewarded:
This number indicates how many seconds Coda SDK will wait before requesting another rewarded ad from Mopub after user sees the previous one in a session. This value will be used internally by Advertisement Module ad requesting procedures

Too Many Ad Count Rewarded Ad

int

20

tooManyAdCountRewardedAd:
This number indicates how many rewarded ads a user must see in a session to be labelled as this user has seen too many rewarded ads. This value will be used internally for ad targeting.

Too Many Ad Count Interstitial Ad

int

20

tooManyAdCountInterstitialAd:
This number indicates how many interstitial ads a user must see in a session to be labelled as this user has seen too many interstitial ads. This value will be used internally for ad targeting.

Too Many Ad Count Banner Ad

int

50

tooManyAdCountBannerAd:
This number indicates how many banner ads a user must see in a session to be labelled as this user has seen too many banner ads. This value will be used internally for ad targeting.

Retention Notification Delay

int

24

retentionNotification_delay: non local time based notifications delay time. When a user kills/backgrounds the app, we schedule a notification after 24 hours.

Excluded Levels

string

excludedLevels:
This value is a comma separated level indices which should be skipped. Note that this variant is not being handled internally by Coda SDK. You can fetch the value inside your level building code (using CodaGameManager.Instance.GameModManager.GetExcludedLevels();) and skip level if it is included in this list.

Retention Notification Content

string

  1. Time to relax? Your favourite game is waiting.
  2. Break Time! Come out & play the game.
  3. It's been a while. 5 minutes game break?
  4. Why play? Well, why not! Tap to start a short one.

retentionNotification1_content,
retentionNotification2_content,
retentionNotification3_content,
retentionNotification4_content:

Texts used in the Retention Notifications. One of these 4 will be selected at random each time.

Coda Consent Popup Content

string

Thank you for your download! Ads on this app are what keeps our service free. To avoid being distracted by random ads, please give us your consent on the next screen.

codaConsentPopupContent:

Text displayed on the in-game Coda consent dialog.

Apple Consent Popup Content

string

Test Apple Consent Popup Content

appleConsentPopupContent:

Text displayed on the simulated native iOS consent dialog.

Local Notification Time

string

18:00:00

localNotificationTime: format is hh:minutes:seconds, 18:00:00 means 6 pm local time.

Local Notification Tolerance Time

string

01:00

localNotificationToleranceTime: a tolerance to decide whether to schedule the notification the the current day or for the next day. For example if we set the notification to 18:00:00 and tolerance is 01:00(format: hh:minute), when the user left the app between 5 to 6 pm then we will schedule it for the next day since tolerance is 1 hour.

Enable Ad Uni tTest

bool

false

enableAdUnitTest:

Enables testing different ad units

Ad Unit Banner Test

string

adUnitBannerTest:

Ad unit to test for banner

Ad Unit Interstitial Test

string

adUnitInterstitialTest:

Ad unit to test for interstitial

Ad Unit Rewarded Test

string

adUnitRewardedTest:

Ad unit to test for rewarded

Revenue Intervals

string

0.0 , 0.01587302, 0.03174603, 0.04761905, 0.06349206, 0.07936508, 0.0952381, 0.11111111, 0.12698413, 0.14285714, 0.15873016, 0.17460317, 0.19047619, 0.20634921, 0.22222222, 0.23809524, 0.25396825, 0.26984127, 0.28571429, 0.3015873, 0.31746032, 0.33333333, 0.34920635, 0.36507937, 0.38095238, 0.3968254, 0.41269841, 0.42857143, 0.44444444, 0.46031746, 0.47619048, 0.49206349, 0.50793651, 0.52380952, 0.53968254, 0.55555556, 0.57142857, 0.58730159, 0.6031746, 0.61904762, 0.63492063, 0.65079365, 0.66666667, 0.68253968, 0.6984127, 0.71428571, 0.73015873, 0.74603175, 0.76190476, 0.77777778, 0.79365079, 0.80952381, 0.82539683, 0.84126984, 0.85714286, 0.87301587, 0.88888889, 0.9047619, 0.92063492, 0.93650794, 0.95238095, 0.96825397, 0.98412698, 1.0

revenueIntervals:

Custom A/B Testing Variants

Custom A/B Testing variants can be defined by developers. You can define a new A/B testing variant from Coda SDK Advanced Settings.

Navigate from Unity Editor to Coda SDK / SettingsNavigate from Unity Editor to Coda SDK / Settings

Navigate from Unity Editor to Coda SDK / Settings

Expand Advance settings and A/B Testing Settings from the Coda SDK Settings panelExpand Advance settings and A/B Testing Settings from the Coda SDK Settings panel

Expand Advance settings and A/B Testing Settings from the Coda SDK Settings panel

How to create a new A/B test variant ?

  • Select the type of the variant
  • Select a unique string key for the variant
  • Enter the default value of the variant
  • Hit create button

How to run an A/B test on a variant ?

  • Go to Firebase dashboard
  • Under Firebase remote section create the variant with the exact same key and assign a remote default value. This value will overwrite the value you have defined in Coda SDK settings.
  • Now you can use Firebase's frontend to create a new A/B testing experiment.

How to access value's of A/B Test variants within the code ?

You can access the actual value of the A/B testing variants within your game code after Coda SDK is initialized. The value will be determined with the following order:

  • If there is a running A/B test on the variant value will be fetched from Firebase according to the user's A/B Testing group.
  • if there is a definition in Firebase Remote Dashboard for the variant key it will fetch and return the remote default value entered in Firebase Remote Dashboard.
  • if there is an entry in the custom or default A/B testing variant config in the Coda SDK Settings the value entered here will be returned.
  • if nothing is defined then the default value of that type will be returned.
// Here is an example Code on how to fetch a variants value:
public void Start()
{
    if(!CodaGameManager.Instance.ABTestingManager.IsInitCompleted())
    {
        CodaGameManager.Instance.ABTestingManager.InitCompleted +=  OnABTestingManagerInit;
    }
    else
    {
        OnABTestingManagerInit();
    } 
}

void OnABTestingManagerInit()
{
    var maxHP = 100; // default max hit points.
    if(CodaGameManager.Instance.ABTestingManager.HasInt("maxHP"))
    {
        maxHP = CodaGameManager.Instance.ABTestingManager.GetInt("maxHP");
    }
}

// Here is the list of all API Calls:
string GetString(string key);
int GetInt(string key);
float GetFloat(string key);
bool GetBool(string key);
long GetLong(string key);

bool HasString(string key);
bool HasInt(string key);
bool HasFloat(string key);
bool HasBool(string key);
bool HasLong(string key);

What’s Next

Please continue with integrating Analytics Module from the link below

Did this page help you?