KODA: Code Generator
"Codings Ruff... I can help!" 😄

SDK Integration

ByteBrew's lightwieght SDKs are compatible with every game engine and platform you use. Download our SDK's on file_download Github


GameMaker Studio Integration tag

free_breakfast Before you start: ByteBrew supports Android 6.0 and above & iOS version 9.0 and above. ByteBrew SDK is compatible with iOS 14 updates.

1: Import ByteBrew GameMaker Extension

Import ByteBrew GameMaker Extension to your project

priority_high Important: Place your game object on the first scene of your game. ByteBrew SDK does not support offline event caching.

2: Go to your ByteBrew Dashboard

Go to your game settings on the ByteBrew dashboard and find your game keys listed on the dashboard.

3: Initialize ByteBrew

You must initialize ByteBrew using the code below at the first scene of your game if you want to start capturing events and sessions.

Inside GameMaker, input the game keys from your game into parameters of the ByteBrew initialization.



byteGameID = "";
byteGameKey = "";

if(os_type == os_ios)
{
    byteGameID = "...iOS Game ID";
    byteGameKey = "...iOS Game Key";
}
else if(os_type == os_android)
{
    byteGameID = "...Android Game ID";
    byteGameKey = "...Android Game Key";
}

//You must make sure add the last two parametes the GameMaker Version and your current version of your project so you can get deep cohort analytics.
ByteBrewExtension_Initialize(byteGameID, byteGameKey, GM_runtime_version, GM_version);

                  
4: Exporting iOS Requirements

ByteBrew requires the following three iOS Frameworks:

A. Security.Framework
B. iAd.Framework
C. AdSupport.Framework

We have already added requirements in the extension to add these frameworks.

5: Exporting Android Requirements

ByteBrew requires the following implementation for android:

A. Play Services Ads Identifier

We have already added requirements in the settings to add this implementation.

Push Notifications tag

priority_high Important: If you are using ByteBrew for Push Notifications, you must call InitializeByteBrew before calling StartPushNotifications.

1: Integrate Push Notifications

Integrating Push Notifications with ByteBrew is super simple. Just add this line of code below after the InitializeByteBrew line.


  ByteBrewExtension_StartPushNotifications();

                  
2: Create Push Notification App on the Dashboard

Set up a Push Notification App in the Push Notification Dashboard. Find the documentation on setting up push notification apps on the Push Notification Documentation Page.

Push Notification Extras (Optional, Android Only)

Add a Custom Small Icon and Large Icon for push notifications.

free_breakfast The small icon automatically defaults to your app icon. We recommend that you add a small icon because your app icon may not appear correctly. If the large icon default is none, it will not show.

Make sure to add these icons to your res android folder. Keep note of the name of the icon, so you can set them in the dashboard when creating a notification.

Push Notification Xcode Export Additions (iOS Only) tag

1: Add UserNotifications.framework

Add UserNotifications.framework to the frameworks and libraries in Xcode.

2: Add Capabilities

Press "+ Capability" and add the following capabilities


3: Add "Background Modes" and check "Remote Notifications"

4: Add "Push Notifications"


Tracking Purchases tag

To track a basic in-app purchase event utilize the below method


  ByteBrewExtension_TrackInAppPurchaseEvent("Apple App Store", "USD", 5.99f, "currencyPack01", "Currencies");

                  
Validate Purchases and Track (Validation Callback) tag

free_breakfast This will also Track the Purchase. Do not track the purchase after validation payload 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 asynchronous call to "Social Events" 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 = "...";
  if(os_type == os_ios)
  {
    ByteBrewExtension_ValidateAndReturnInAppPurchaseEvent("Apple App Store", "USD", 1.99, "NoAds", "NoAds", "EMPTY", "");
  }
  else
  {
    //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.
    googleReciept = "...";
    googleSignature = "...";
    ByteBrewExtension_ValidateAndReturnInAppPurchaseEvent("Google Play Store", "USD", 1.99, "NoAds", "NoAds", "EMPTY", "NOPE");
  }

                  

Next, grab the purchase data from the Async Social Event.



  isValid = "";
  itemID = "";


  if (async_load[? "type"] == "bytebrew_purchase_status")
  {
    isValid = async_load[? "isValid"]; //This will be a string of either "true" or "false"
    itemID = async_load[? "itemID"];
    
    
    show_message_async(string(isValid) + " Valid");
    show_message_async(string(itemID) + " Purchase Item");
  }

                  
Track purchase with extra receipt validation (No Callback) tag

To track the in-app purchase and basic receipt validation utilize the specific platform method.

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.
  iosReciept = "...";
  ByteBrewExtension_TrackInAppPurchaseEventWithValidation("Apple App Store", "USD", 5.99f, "currencyPack01", "Currencies", iosReciept, "Leave me empty if your tracking ios");

  //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.
  googleReciept = "...";
  googleSignature = "...";
  ByteBrewExtension_TrackInAppPurchaseEventWithValidation("Google Play Store", "USD", 5.99f, "currencyPack01", "Currencies", googleReciept, googleSignature);

                  

Custom User Data Attributes tag

Add data attributes to your users such as: level, username, etc. These can be directly used for segmentation purposes in push notifications and more.


  ByteBrewExtension_SetCustomUserDataWithString("username", "michael_scarn");
  ByteBrewExtension_SetCustomUserDataWithDouble("total_hitpoints", 68.7);
  
  //You have to set the values as a string for these and we will cast them accordingly
  ByteBrewExtension_SetCustomUserDataWitInteger("dundees", "3");
  ByteBrewExtension_SetCustomUserDataWithBoolean("loves_the_office", "true");


                  

Custom Event Tracking tag

For the most basic form of custom event tracking, use the follow code line. This will track the event name and default the value to 1.


  //Example 1
  ByteBrewExtension_AddCustomEvent("shopOpen");

  //Format
  ByteBrewExtension_AddCustomEventWithStringValue("CustomEventName", "Key=Value;");

  //Example 2
  ByteBrewExtension_AddCustomEventWithStringValue("GamePurchaseVC", "currency=GOLD;amount=500;character=viking;");
  ByteBrewExtension_AddCustomEventWithStringValue("LevelCompleted", "level=25;character=viking;");

                  
Basic value parameter custom event tag

To add more detail to an event you can add a secondary parameter, that can be a double or string value


  //string example
  ByteBrewExtension_AddCustomEventWithStringValue("weapon_equip", "megablaster");

  //double example
  ByteBrewExtension_AddCustomEventWithDoubleValue("lives_earned", 5.0);

                    
Dictionary parameter custom event tag

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;"
  ByteBrewExtension_AddCustomEventWithStringValue("level_started", "weapon=megablaster;powerup=extralife;");


                    

Progression Event Tracking tag

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 double value attached to the event


  //Example Progression event where the user started a tutorial in arena 0 or first arena
  ByteBrewExtension_AddProgressionEvent("Started", "Tutorial", "arena0");

  //Example progression event where the user has completed the kings arena and could be rewarded with 3 crowns
  ByteBrewExtension_AddProgressionEventWithDoubleValue("Completed", "Arena", "kings_arena", 3.0);

                  

Ad Event Tracking tag

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 (Recommended)
  ByteBrewExtension_AddTrackedAdEventWithAllOptions("Interstitial", "EndOfLevel", "3253k3302-3r3j4i343-3nij343-405403", "AdMob");

  //Some ad event paramters can be ommited like so
  ByteBrewExtension_AddTrackedAdEvent("Interstitial", "EndOfLevel");
  ByteBrewExtension_AddTrackedAdEventWithAdID("Interstitial", "EndOfLevel", "3253k3302-3r3j4i343-3nij343-405403");

                  

Remote Config & AB Testing tag

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

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.

ByteBrew automatically calls LoadRemoteConfig on initialization but you can call it again when needed.


  //Call the loader to update configs 
  ByteBrewExtension_LoadRemoteConfig();
  
  //Check if the remote configs are ready and set
  ByteBrewExtension_HasRemoteConfigsBeenSet();

                  

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
  configValue = ByteBrewExtension_RetrieveRemoteConfig("KEY", "DEFAULT VALUE IF NOT AVAILABLE");

                  

To view your game's remote configs visit the remote config page on the ByteBrew dashboard.

Get User ID tag

Get the current userID of the user, use this to find specific user for ex. Push Notifications.


  // Get the string userID
  ByteBrewExtension_GetUserID();


                  

Stop Tracking Current User tag

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.


  ByteBrewExtension_StopTracking();