Analytics

Logging events and state changes to track user behaviour within a module

Using the AnalyticService functionality you can add analytic events to your module.

Events

Oooh currently supports three types of events: pages, custom and replay.

Page Events

Use AnalyticService.setPage() to send page events to record the user's path through a module. The pageName can be any valid text string, however the following are expected:

  • SplashScreen: When the splash screen is fully loaded and "tap to continue" is available
  • Tutorial: When / if the tutorial is visible
  • Gameplay: When gameplay/recording starts, including creator customisation screens
  • EndScreen: Final screen containing "Retry" and "Done" options

Custom Events

Use AnalyticService.logCustomEvent() to send custom data to the analytics service. Both the key and value can be any valid text string.
This can be anything of interest, like what menu choices are players making, or average playtime, etc. These values are calculated by the module itself.
Suggested format for key is pageName_dataName. For example:

  • If you were tracking the buttons that the users clicked on the main menu, key would be SplashScreen_Choice and value could be "3" (third button)

Replay Events

Use AnalyticService.replay() to track how many times a user chooses to replay the module. The analytic service will automatically track the cumulative total.

Example Code

import * as o3h from "/api/o3h";

const runtime = o3h.Instance;

// Set up analytic service, and allow it to be accessed from any class
window.analyticService = runtime.getAnalyticService();

await setState(ModuleState.SplashScreen);

this.runtime.ready(() => {
  moduleStart();
});

function moduleStart() {
    // splash screen visible
}

async function setState(newState) {
    this.currentState = newState;

    switch (this.currentState) {
      case ModuleState.SplashScreen:
        await this.showSplashScreen();
        window.analyticService.setPage("SplashScreen");
        break;
      case ModuleState.Tutorial:
        await this.showTutorial();
        window.analyticService.setPage("Tutorial");
        break;
      case ModuleState.Gameplay:
        await this.showGameplay();
        window.analyticService.setPage("Gameplay");
        break;
      case ModuleState.EndScreen:
        await this.showEndScreen();
        window.analyticService.setPage("EndScreen");
        break;
    }
}

function showSplashScreen() {
  for (let i = 1; i <= 5; i++) {
    document.getElementById("categoryButton" + i.toString()).onclick = () => {
      this.onCategoryButtonPressed(i);
    }
  }

  document.getElementById("replayButton").onclick = () => {
      this.onReplayButtonPressed();
  }
  
  // await asset loading
}

async function onCategoryButtonPressed(index) {
  // Send custom event with user's Main Menu button choice 
  window.analyticService.logCustomEvent("SplashScreen_Choice", index);
  
  await this.animateButton("#mainMenuButton" + index);
  this.hide();
  this.endFunc(index);
}

function onReplayButtonPressed() {
  // Send replay event to analytic service
  window.analyticService.replay();
  
  this.initializeModule();
}

A/B Testing

The Oooh platform has the ability to run multi variant tests within a module.

Please speak with a member of Oooh to define any test that you would like to run.

Loading variant values

A/B testing values are loaded via module config values.

Configuration values are presented as string -> string key value pairs. White space is not allowed for A/B testing key values, but values can contain spaces.

In your module code load the value of a key you are expecting for an A/B test and switch your code logic based on the returned value. Also check for a null return value and handle any unexpected cases with a reasonable fallback behaviour (ie: the control group).

You can set Configuration values in the SDK for testing different options.