Mission events

Mission events allow you to capture detailed information about player actions and progression stages within your game. This includes tracking both linear (e.g., levels, tutorial) and non-linear (e.g., meta, daily challenges) progressions, along with other key engagement metrics.

Events

MissionStarted

Use this event when a player starts a mission.

LionAnalytics.MissionStarted(bool isTutorial, string missionType, string missionName,string missionID, int? missionAttempt = null);

MissionStep

Use this event when a player reaches a significant step or checkpoint within a mission.

LionAnalytics.MissionStep(bool isTutorial, string missionType, string missionName, string missionID, int userScore, int? missionAttempt = null);

MissionCompleted

Use this event when a player successfully completes a mission.

LionAnalytics.MissionCompleted(bool isTutorial, string missionType, string missionName, string missionID, int userScore, int? missionAttempt = null);

MissionFailed

Use this event when a player fails a mission.

LionAnalytics.MissionFailed(bool isTutorial, string missionType, string missionName, string missionID, int userScore, int? missionAttempt = null);

MissionAbandoned

Use this event when a player abandons a mission before completion or presses the restart button.

LionAnalytics.MissionAbandoned(bool isTutorial, string missionType, string missionName, string missionID, int userScore, int? missionAttempt = null);

Main Parameters

Field Example Description
missionType 
“main” Top-level type of the mission
missionName 
“main_1”, “main_2”, “main_3” Specifies the level grouping (e.g., season, bundle, pack). A single missionID may be paired with different missionName parameters.
missionID 
“1”, “2”, “3”…. Identifier for the level, mission, or mission step
missionAttempt 
1, 2, 3, 4… Count of attempts for the level or mission

Implementation

Each mission must have an event that marks its start (opening event) and an event that marks its end (closing event). Additionally, if there are key moments or milestones within the mission, you can track those using optional intermediate event, but these are not always required.

Opening Event

  • MissionStarted: Marks the beginning of a new level or mission attempt.

Intermediate Event

  • MissionStep: Indicates a significant step or checkpoint within a level or mission.

Closing Events

  • MissionCompleted: Signifies the successful completion of a level or mission.
  • MissionAbandoned: Indicates the player left the level or mission without completing it.
  • MissionFailed: Marks the end of a level or mission attempt with an unsuccessful outcome.

Examples

Levels Tracking

Soft Fail & Revive Tracking

Handling Attempts

Code Example

    // Call this when the player starts a level
    void OnLevelStart(int level, int attempts)
    {
        LionAnalytics.MissionStarted(
            isTutorial: false,
            missionType: "main",
            missionName: $"main_{level}",
            missionID: $"{level}",
            missionAttempt: attempts
        );
    }

    // Call this when the player completes a level
    void OnLevelComplete(int level, int attempts, int score)
    {
        LionAnalytics.MissionCompleted(
            isTutorial: false,
            missionType: "main",
            missionName: $"main_{level}",
            missionID: $"{level}",
            userScore: score,
            missionAttempt: attempts
        );
    }

    // Call this when the player fails a level and no Revive is possible, 
    // or when the Revive is declined.
    void OnLevelFail(int level, int attempts)
    {
        LionAnalytics.MissionFailed(
            isTutorial: false,
            missionType: "main",
            missionName: $"main_{level}",
            missionID: $"{level}",
            missionAttempt: attempts
        );
    }
    
    // Call this when the player fails but is given a chance to Revive 
    void OnSoftFail(int level, int attempts, int score)
    {
        LionAnalytics.MissionStep(
            isTutorial: false,
            missionType: "main",
            missionName: $"main_{level}",
            missionID: $"{level}",
            userScore: score,  
            missionAttempt: attempts,
            stepName: "soft_fail"
        );
    }
    
    // Call this when the player chooses to Revive 
    // (by spending coins, watching an RV...).
    void OnRevive(int level, int attempts, int score)
    {
        LionAnalytics.MissionStep(
            isTutorial: false,
            missionType: "main",
            missionName: $"main_{level}",
            missionID: $"{level}",
            userScore: score, 
            missionAttempt: attempts,
            stepName: "revive"
        );
    }