Game Maker Firebase Analytics

I have finished my Game Maker Firebase Analytics Extension and it is now ready to be used. With this extension, you can track important things such as retention rate, where are your players from, or you can track things like “How many Golds are spent on my game”, or “how much did I make with Ads” as it automatically tracks them for you.

Setup Firebase Tools for Game Maker Studio

To be able to use the extension, you must prepare Game Maker Studio 2 to be able to compile for it. Click the link above to complete it.
For now, the extension only works at Android Exports.

DOCUMENTATION

firebase_analytics_debug_mode(True/False debugMode?);
Description : Enables or disables debug logging. You’ll see the debug output on Game Maker Studio IDE(Output).
Notice : You can use this function before/after firebase_analytics_init.

firebase_analytics_init();
Description : Initializes Game Maker Firebase Analytics SDK. The extension does not start collecting data unless you start it by this function. You can however, start/stop data collecting in the runtime(See the functions related to this below)
Notice : You can call this function in any part of your game. This function must be called before using any other Firebase Analytics functions.

firebase_analytics_set_user_id(String userID);
Description : Sets the user ID. This can be anything like user’s Google Play Games ID, or your game has a registration system and you can use the player’s ID for this. You’ll see this ID on Firebase Analytics Dashboard.

firebase_analytics_user_id("gamer1236544");

firebase_analytics_current_screen(String screenName);
Description : Game Maker Firebase Analytics sets the current Screen Name where the player is standing at. You can use this function to track which areas of your game are visited most etc.

firebase_analytics_user_property("main_menu_screen");

firebase_analytics_user_property(String propertyName, String propertyValue);
Description
: With this function, you can set a value for a user property. These properties are carried throughout the session and added to analytics reports.

firebase_analytics_user_property("language_choice","japan"); 

firebase_analytics_post_string(String key, String value, String event);
Description
: Posts an Analytics Event to Firebase. The value is a string.

firebase_analytics_post("weapon","Red Sword","weapon_choice_list");

firebase_analytics_post_real(String key, Real value, String event);
Description
: Posts an Analytics Event to Firebase. The value is a double(real/number). You can track something like “how much gold is earned by all players” etc.

firebase_analytics_post("earned_gold",100,"economy");

firebase_analytics_enable();
Description
: Enable collecting user data.
Notice : Calling firebase_analytics_init does automatically start this process. I advise you to create a system, ask for user’s consent and save the choice. You can check the choice and use firebase_analytics_init thereafter.

firebase_analytics_disable();
Description
: Disables collecting user data.

firebase_analytics_event_post_score(Real Score, Real Level, String Character);
Description : Sends a POST_SCORE event to the Firebase. Useful for seeing the score analytics.

firebase_analytics_event_post_score(100, 1, "fire_dragon");

I made 100 points in Level 1 with the Fire Dragon character.

firebase_analytics_event_earn_virtual_currency(String CurrencyName, Real Value);
Description : Sends a EARN_VIRTUAL_CURRENCY event to Firebase. This is very useful for tracking the money flow within the game, see how much money in different in-game currencies are earned; etc. (gold, diamon, dollar)

firebase_analytics_event_earn_virtual_currency("gold", 1500);
firebase_analytics_event_earn_virtual_currency("diamond", 5);

firebase_analytics_event_spend_virtual_currency(String CurrencyName, String itemName, Real Value);
Description : It sends a SPEND_VIRTUAL_CURRENCY event to Firebase. Likewise, useful for tracking the money flow, to seeing where the money goes.

firebase_analytics_event_spend_virtual_currency("gold", "health_potion", 1000);

I spend 1000 gold to buy a health potion.

firebase_analytics_event_unlock_achievement(String AchievementID);
Description : Sends an UNLOCK_ACHIEVEMENT event to Firebase. This is useful for tracking down which achievements are unlocked by users etc.

firebase_analytics_event_unlock_achievement("achievement_kill_100_zombies");

firebase_analytics_event_select_content(String ContentType, String ItemID);
Description : It sends a SELECT_CONTENT event to Firebase. This is useful for seeing which items or catalogs (maybe item shops, anything you can imagine) that users select.

firebase_analytics_event_select_content("potion_shop", "mana_potion_large");

The player has just selected the Large Mana Potion in Potion Shop

firebase_analytics_event_login(String LoginService);
Description : It sends a LOGIN event to Firebase. If you have a login option in your game with different options(Normal login, Google login, Facebook login etc.), you can track them with this function.

firebase_analytics_event_login("Facebook");
firebase_analytics_event_login("Google");
//etc..

firebase_analytics_event_level_start(String LevelName);
Description
: It sends a LEVEL_START event to Firebase. This indicates that the player has started a level.

firebase_analytics_event_level_start("boss_level");

firebase_analytics_event_level_end(String LevelName, True/False Success);
Description : It sends a LEVEL_END event to Firebase. If the player fails to complete the level (dies or runs out of time etc.), you can set the second parameter as false.

///I died. I failed the level.
firebase_analytics_event_level_end("boss_level", false);
//Okay. Let's start the level again.
firebase_analytics_event_level_start("boss_level");
//Now I killed the boss and I finished the level successfully.
firebase_analytics_event_level_end("boss_level", true);

firebase_analytics_event_share(String ContentType, String ItemID, String Method);
Description : It sends a SHARE event to Firebase. If you have a mechanism that allows you to share something in your game, you can use this function to track them down.

firebase_analytics_event_share("social_share", "play_with_me", "facebook");

Player shared something to Facebook as Play With Me

Get it on Marketplace (FREE)

If you’re interested in, the open source code is at GitHub

Share

Marty

Truely speaking, I don't know what am I doing most of the time.

1 Response

  1. 17th April 2019

    […] Firebase Analytics for Game Maker […]

Leave a Reply