GameAnalytics / GA-SDK-JAVASCRIPT

Official repository for GameAnalytics JavaScript SDK
MIT License
19 stars 6 forks source link

Events which sent soon after initialize() can be lost because of false "SDK is disabled" decision #398

Open Scmorrka opened 10 months ago

Scmorrka commented 10 months ago

In my game I've implemented recommended sequence:

// Configure build version configureBuild("some build"); // Initialize initialize(key1, key2); // Add Design event ... addDesignEvent("General:App_Started"); ... addDesignEvent("General:BannerEnabled"); ... addDesignEvent("General:FUE1_shown");

For ~10-15% of players I see one or two or more first events are lost. For example, log shows "Could not add design event :SDK is disabled" for two first events and then other events are sent with no problem.

Checking SDK code I see following:

In my game I tried to add delay like 1.5 seconds but still see lost events anyway. Even 3 seconds isn't a guarantee.

I see no possibility to track/wait for internal request finish and only then start sending design events. Probably I can use isSdkReady method but I think creating my own local queue of event to wait until isSdkReady is true is wrong because SDK declared as doing the same internally. Probably GAState.instance.initAuthorized should be three state flag "not_yet_checked", "authorized" and "not_authorized" to allow adding events in queue after initialize even with slow or no internet connection.