Helper Functions

LionAnalytics provides global functions to affect future events.

AB Testing

AbCohort()

  • Overview: The method should be fired every session. If a user is in multiple AB tests, the event should be fired multiple times. This will attach the cohort information to all events.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
experimentNamestringRequiredThe experiment name
experimentCohortstringRequiredThe cohort name
additionalDatadictionaryOptionalAny additional information associated with failing to initiate the system. Such as more details error message, attempts, elapsed time etc.

ClearAbCohort()

  • Overview: Clear an AbCohort Experiment (Not commonly used). Only use this if you set up client code to check for FeatureFlags during a session and can resond to players changing experiment participation mid-session.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
experimentNamestringrequiredName of the abCohort experiment to clear from proceeding events.

Additional Data

SetGlobalAdditionalData()

  • Overview: This method allows developers to add their own global parameter values that will be fired off with every subsequent event.
  • Returnsvoid
  • Parameters overload 1:
ParametertypeRequiredDescription
mapDictionaryRequiredDevelopers can pass a Dictionary<string, object> and the event will loop through and add all the desired key value pairs.
  • Parameters overload 2:
ParametertypeRequiredDescription
itemstringRequiredThe name of the data to add to as a global parameter value.
valobjectRequiredThe value associated with the key of the global parameter.

ClearGlobalAdditionalData()

  • Overview: Clears an entry in the developer provided global additional data
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
keystringRequiredThe name of the item to remove.

ClearGlobalAdditionalData()

  • Overview: Clears all the developer provided global additional data
  • Returnsvoid
  • Parameters: None

Player data

SetPlayerLevel()

  • Overview: This method sets the global Player Level (account) value that will be attached to all events. It should be called anytime the Player Level changes.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
playerLevelintegerRequiredThis is the value of the player’s account level (not gameplay level).

ClearPlayerLevel()

  • Overview: Clear a players level, and remove the tracking from other events
  • Returnsvoid
  • Parameters: None

SetPlayerScore()

  • Overview: This method sets the global Player Score value that will be attached to all events.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
userScoreintegerOptionalThis is the value of the player’s score.

ClearPlayerScore()

  • Overview: Clear a players score, and remove the tracking from other events
  • Returnsvoid
  • Parameters: None

SetPlayerXP()

  • Overview: This method sets the global Player XP (experience) value that will be attached to all events. It should be called anytime the Player XP changes.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
playerXpintegerRequiredThis is the value of the player’s XP (experience).

ClearPlayerXP()

  • Overview: Clear Player XP.
  • Returnsvoid
  • Parameters: None

Monetization

SetSoftCurrency()

  • Overview: This method sets the global Soft Currency Balance (virtual currency) value (wallet value) that will be attached to all events. It should be called anytime that virtual currency is spent or received.
  • Returnsvoid
  • Parameters: Parameters:
ParametertypeRequiredDescription
softCurrencyintegerRequiredThis is the new value of the player’s soft currency balance (wallet).

ClearSoftCurrency()

  • Overview: Clear Soft Currency.
  • Returnsvoid
  • Parameters: None

SetHardCurrency()

  • Overview: This methods sets the global Hard Currency Balance (real currency) value (wallet value) that will be attached to all events. It should be called anytime that real currency is spent or received.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
hardCurrencyintegerRequiredThis is the new value of the player’s hard (real) currency balance (wallet).

ClearHardCurrency()

  • Overview: Clear Hard Currency balance.
  • Returnsvoid
  • Parameters: None

Game Data

GetTotalTimeInApp()

  • Overview: Returns the time in app variable that is being tracked on to all LA events currently.
  • Returnsint
  • Parameters: None

SetTutorial()

  • Overview: Set Tutorial
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
tutorialStateboolRequiredValue used to determine if an event is a tutorial or not.
trackMissionstringRequiredUsed to check internally if a tutorial has started or finished.

RemoveLevelAttemptTrackingData()

  • Overview: Clears internal attempt number tracking data for a specified level. You should not need this.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
levelNumintegerRequiredGame Level being played.
levelCollection1stringRequiredCollection of Game Levels. The second-order grouping.
levelCollection2stringRequiredCollection of lower level collections (second-order). The third-order grouping.
missionTypestringRequiredIndicate the type of the mission, level, task, quests etc. (within the level).
missionNamestringRequiredName of side Mission that takes place within a Game Level.

RemoveMissionAttemptTrackingData()

  • Overview: Clears internal attempt number tracking data for a specified mission You should not need this.
  • Returnsvoid
  • Parameters:
ParametertypeRequiredDescription
missionTypestringRequiredIndicate the type of the mission, level, task, quests etc. (within the level).
missionNamestringRequiredName of side Mission that takes place within a Game Level.
missionIDstringRequiredThe unique ID for the mission.