Analytics: Yes2SDK.analytics

← Back to overview

Track gameplay events. All methods are synchronous, fire-and-forget.

Good to know: Custom events (logEvent, logScore, logTutorial, logPurchase) are recorded locally on every platform. Bring your own analytics pipeline if you need delivery. Exception (Yandex): when a Metrica counter ID is configured for the game (dashboard game settings), these events are additionally delivered to Yandex Metrica as reachGoal calls (see the Yandex quickstart). The gameplay lifecycle is wired to each platform's real engagement signals: logLevelStart/logLevelEnd drive gameplayStart/gameplayStop, which platforms use for monetization timing. Jest has no gameplay signal, so on Jest all analytics calls are logged locally only.


Methods (Core)

SignatureDescription
logEvent(eventName: string, valueToSum?: number, parameters?: AnalyticsParameters): voidCustom event. eventName must be non-empty.
logLevelStart(level: string): voidLevel start. Drives gameplayStart where supported.
logLevelEnd(level: string, score?: number, success?: boolean, durationSeconds?: number): voidLevel end. Drives gameplayStop where supported.
logScore(score: number, level?: string): voidScore event.
logTutorial(step: string, completed: boolean): voidTutorial event. step must be non-empty.
logPurchase(productId: string, price: number, currency: string): voidPurchase event. productId/currency non-empty.
logTutorialStart(): voidAlias → logTutorial("tutorial_start", false).
logTutorialEnd(): voidAlias → logTutorial("tutorial_end", true).
isSupported(): booleanWhether analytics is supported (true, covers gameplay tracking).

AnalyticsParameters = Record<string, string | number | boolean>


Platform support

MethodPokiGameDistributionCrazyGamesYandexYouTubeJest
logEventNone¹None¹None¹Metrica⁵None¹None⁶
logLevelStartPartial²Partial³Partial²Partial²˒⁵None⁴None⁷
logLevelEndPartial²Partial³Partial²Partial²˒⁵None⁴None⁷
logScoreNone¹None¹None¹Metrica⁵None¹None⁶
logTutorialNone¹None¹None¹Metrica⁵None¹None⁶
logPurchaseNone¹None¹None¹Metrica⁵None¹None⁶
isSupportedReadyReadyReadyReadyReadyReady

¹ Logged locally (logger.debug) only: no platform delivery. ² Logs locally and calls the real gameplayStart/gameplayStop (PokiSDK, CrazyGames sdk.game, Yandex GameplayAPI). ³ GameDistribution drives internal gameplay state only (no platform gameplay call). ⁴ YouTube sets an internal gameplay flag only. Note: on YouTube the SDK additionally exposes real reportError/reportWarning backed by ytgame.health.logError/logWarning (not part of the cross-platform analytics surface). ⁵ Yandex only, when a Metrica counter ID is configured for the game: the call also fires ym('reachGoal', …). Goal name is the eventName for logEvent; score / tutorial / purchase / level_start / level_end for the typed methods. Without a counter configured it degrades to local logging (¹). Metrica is separate from the YaGames SDK. The dashboard injects the counter tag into Yandex builds. See the Yandex quickstart. ⁶ Jest: logged locally only. Yes2SDK does not forward events to Jest's own event capture, which Jest has retired. ⁷ Jest: logged locally only. Jest has no gameplay start or stop signal, so nothing reaches the platform. See the Jest guide.


Unity (C#)

Yes2SDK.Analytics (Yes2SDKAnalytics).

SignatureDescription
void LogEvent(string name, Dictionary<string, object> parameters = null)Custom event.
void LogLevelStart(string level)Level start (Poki → gameplayStart()).
void LogLevelEnd(string level, int score, bool success, float durationSeconds = -1f)Level end. Negative duration = omitted.
void LogScore(int score, string level = "")
void LogTutorialStart()
void LogTutorialEnd()
void LogPurchase(string productId, float price, string currency)

Defold (Lua)

SignatureDescription
yes2sdk.analytics_log_level_start(level)
yes2sdk.analytics_log_level_end(level, score, success, duration_seconds)duration_seconds optional (nil/negative → omitted).
yes2sdk.analytics_log_score(score, level)
yes2sdk.analytics_log_tutorial_start()
yes2sdk.analytics_log_tutorial_end()
yes2sdk.analytics_log_game_choice(decision, choice)Logs a game_choice custom event {decision, choice}.
Get started