7: (optional iOS only, skip if not needed): Call ByteBrew's ATT(App Tracking Transparency) wrapper tag
ByteBrew offers the ability to not have to call native code in your unity application, if you are using our attribution please call this before initializing our SDK.
If you do choose to use our ATT Handler, please make sure that you do the following in your info.plist:
A. Use the Xcode Property List Editor to add: Privacy - Tracking Usage Description
B. In the value string field enter a sentence or statement for the reason behind you tracking request.
// Call ByteBrew ATT Wrapper
ByteBrew.requestForAppTrackingTransparency((status) =>
{
//Case 0: ATTrackingManagerAuthorizationStatusAuthorized
//Case 1: ATTrackingManagerAuthorizationStatusDenied
//Case 2: ATTrackingManagerAuthorizationStatusRestricted
//Case 3: ATTrackingManagerAuthorizationStatusNotDetermined
Debug.Log("ByteBrew Got a status of: " + status);
ByteBrew.InitializeByteBrew();
});
8: Exporting iOS Requirements
ByteBrew requires the following three iOS Frameworks:
A. Security.Framework
B. iAd.Framework
C. AdSupport.Framework
Implement these in your final xcode project as frameworks.
Validate Purchases and Track (Validation Callback) tag
free_breakfast This will also Track the Purchase. Do not track the purchase after validation callback is received or else it will double the purchases tracked.
To validate and track the in-app purchase utilize the specific platform method. This will create a purchase callback that will return a payload with purchase details and verification status.
priority_high Important: Make sure the receipts have correct JSON string formatting.
//JSON Format ex. string json = "{\"firstname\":\"john\", \"lastname\":\"doe\",\"age\":30}";
//Retrieve the iOS receipt from the purchase event that occurs. We will validate it server side so you can view valid purchases in you dashboard.
string iosReciept = "...";
ByteBrew.ValidateiOSInAppPurchaseEvent("Apple App Store", "USD", 1.99f, "NoAds", "NoAds", "EMPTY",
purchaseResultData => {
Debug.Log("ByteBrew Purchase Processed: " + purchaseResultData.purchaseProcessed); //bool telling if the purchase even went to the server to get checked
Debug.Log("ByteBrew Purchase Is Valid: " + purchaseResultData.isValid); //bool signaling if the purchase is real or fake
Debug.Log("ByteBrew Purchase Message: " + purchaseResultData.message); //Message from the server telling the explaination behind the decision
Debug.Log("ByteBrew Purchase timestamp: " + purchaseResultData.timestamp);
});
//Retrieve the Android receipt and Signature from the purchase event that occurs. We will validate it server side so you can view valid purchases in you dashboard.
string googleReciept = "...";
string googleSignature = "...";
ByteBrew.ValidateGoogleInAppPurchaseEvent("Google Play Store", "USD", 1.99f, "NoAds", "NoAds", "RECEIPT HERE", "SIGNATURE HERE",
purchaseResultData => {
Debug.Log("ByteBrew Purchase Processed: " + purchaseResultData.purchaseProcessed); //bool telling if the purchase even went to the server to get checked
Debug.Log("ByteBrew Purchase Is Valid: " + purchaseResultData.isValid); //bool signaling if the purchase is real or fake
Debug.Log("ByteBrew Purchase Message: " + purchaseResultData.message); //Message from the server telling the explaination behind the decision
Debug.Log("ByteBrew Purchase timestamp: " + purchaseResultData.timestamp);
});
The Returned Results:
purchaseProcessed. Boolean saying if the purchase was processed by server.
isValid. Boolean telling if the purchase is Real or Fake
The Returned Result message, will give you an output of either of these as an explaination:
A. "Validation Successful, real purchase."
B. "Validation Failed, fake purchase."
C. "Error validating receipt, check game configs."
If you get Option C, check to make sure the purchaseProcessed boolean is True and to go to your game settings on ByteBrew to update your Apple App Shared Secret or Google Play License Key.
Track purchase with extra receipt validation (No Callback) tag
To track the in-app purchase and basic receipt validation utilize the specific platform method.
priority_high Important: Make sure the receipts have correct JSON string formatting.
//JSON Format ex. string json = "{\"firstname\":\"john\", \"lastname\":\"doe\",\"age\":30}";
//Retrieve the iOS receipt from the purchase event that occurs. We will validate it server side so you can view valid purchases in you dashboard.
string iosReciept = "...";
ByteBrew.TrackiOSInAppPurchaseEvent("Apple App Store", "USD", 5.99f, "currencyPack01", "Currencies", iosReciept);
//Retrieve the Android receipt and Signature from the purchase event that occurs. We will validate it server side so you can view valid purchases in you dashboard.
string googleReciept = "...";
string googleSignature = "...";
ByteBrew.TrackGoogleInAppPurchaseEvent("Google Play Store", "USD", 5.99f, "currencyPack01", "Currencies", googleReciept, googleSignature);
For the most basic form of custom event tracking, use the follow code line. This will track the event name (Ex. shopOpen) and default the value to 1.
priority_high Important: Make sure to utilize our Custom Event schema for formatting custom events on the platform. Do not use custom events formats from other platforms to track events. When making custom events use "_" instead of spaces. This also applies to additional parameters "key_name=value;".
To add additional custom parameters to an event you can format a string with key=value; pairs. Checkout the example below.
//Key Value format "key=value;"
//It can take multiple pairs as well, "key1=pair1;key2=pair2;key3=pair3;"
ByteBrew.NewCustomEvent("level_started", "weapon=megablaster;powerup=extralife;");
//Utilize this method to send Dictionary values to return a tokenized string ready to be sent with the custom event
public string ParseEventValues(Dictionary values)
{
var parsedValueSTR = "";
foreach(var keyPair in values)
{
parsedValueSTR += String.Format("{0}={1};", keyPair.Key, keyPair.Value);
}
return parsedValueSTR;
}
//We made an easy way to load in these key pairs, look at this code
var customValues = new Dictionary()
{
{"weapon", "megablaster"},
{"powerup", "extralife"}
};
//And then pass in the method that returns the tokenized string
ByteBrew.NewCustomEvent("level_started", ParseEventValues(customValues));
You can track a progression event using the parameters list below.
Progression events get tracked based on the following parameters:
1: ProgressionType
The type of event context that occured. Must use one of the following: Started, Completed or Failed
2: Environment
Area of the game or World it occurs (Ex. Tutorial, Arena, Level)
3: Stage
The stage of the environment (Ex. kings_arena, jungleLevel, level_02)
4: Value
This can be a string or float value attached to the event
//Example Progression event where the user started a tutorial in arena 0 or first arena
ByteBrew.NewProgressionEvent(ByteBrewProgressionTypes.Started, "Tutorial", "arena0");
//Example progression event where the user has completed the kings arena and could be rewarded with 3 crowns
ByteBrew.NewProgressionEvent(ByteBrewProgressionTypes.Completed, "Arena", "kings_arena", 3f);
//Basic Example of Started Progression event with basic levels
ByteBrew.NewProgressionEvent(ByteBrewProgressionTypes.Started, "Levels", "level_01");
//Basic Example of Completed Progression event with basic levels
ByteBrew.NewProgressionEvent(ByteBrewProgressionTypes.Completed, "Levels", "level_01");
Track ad events that occur to get more detailed breakdowns in your monetization, especially when doing LTV and ROAS calculations.
// Record the Placement Type, Location of the placement, ad unit ID, and Network
ByteBrew.TrackAdEvent("Interstitial", "EndOfLevel", "3253k3302-3r3j4i343-3nij343-405403", "AdMob");
//Some ad event paramters can be ommited like so
ByteBrew.TrackAdEvent("Interstitial", "EndOfLevel");
ByteBrew.TrackAdEvent("Interstitial", "EndOfLevel", "3253k3302-3r3j4i343-3nij343-405403");
Remote configs help you edit your apps settings and configuration without needed to update your app on the store.
AB Testing is to cross track changes across a variety of users when they onboard to your game, we distribute AB Test variables from remote configs. So make sure to check for the AB test you are tracking
free_breakfast Before you start: If you are calling to get/update Remote Configs in the same scene and right after you call ByteBrew's initialize, it's recommended to wait 1-2 seconds before calling to get/update Remote Configs to allow ByteBrew to fully initialize.
1: Loading the Remote Configs
When using Remote Config you must first call for the config to get updated. You can call this whenever you want to update the configs.
//Call the Action handler
ByteBrew.RemoteConfigsUpdated(() =>
{
//Do Whatever you want here once the config is updated
});
//Check if the remote configs are ready and set
ByteBrew.HasRemoteConfigsBeenSet();
2: Retrieve the Config
Finally once the action handler has finished, you can call the remote config method below.
You can grab AB Test keys and values from this method as well, if the user is part of the control group it wont return anything but the default parameter value set.
//Call to get the key specific value and if the key doesn't exist it will return the default variable specified, like if the AB test user is in the control group
ByteBrew.GetRemoteConfigForKey("dailyWeapon", "goldRevolver");
To view your game's remote configs visit the remote config page on the ByteBrew dashboard.
Call the ByteBrew StopTracking method to stop and disable tracking for a user. Alternatively, if you have your own consent prompt, you can delay the intialization of the ByteBrew SDK until your user has consented to be tracked.
priority_high Important: When updating the SDK, remove the ByteBrewSDK from the Assets folder, then reimport the updated SDK and make sure to reinput the SDK Keys into the engine.