Back to .md Directory

analytics

Documents the analytics event schema for StoryPlayer, listing event types, names, and payload fields.

May 2, 2026
0 downloads
2 views
ai rag
View source

What this file does

Documents the analytics event schema for StoryPlayer, listing event types, names, and payload fields.

When to use it

  • Integrating StoryPlayer with an analytics backend
  • Implementing custom event handlers for user interaction tracking
  • Extending the event system with new event types
  • Validating event payloads in tests or logging

Assumes this stack

JavaScript

Analytics

StoryPlayer generates analytics events so that we can record what users are doing. These are handled by a function that is passed into StoryPlayer; this function might write some or all of these events into a database. This function takes a single argument, which is a JavaScript Object containing the data. This Object has the following attributes:

  • type - String giving event type (see below for details)
  • name - String giving event name (see below for details)
  • from - String representing 'from' state
  • to - String representing 'to' state
  • current_narrative_element - UUID of current Narrative Element
  • current_representation - UUID of current Representation
  • userid - automatically generated UUID. If the saveSession attribute for StoryPlayer is true this uuid is stored in local storage and used across multiple sessions. Otherwise it lasts for the session. userid is unique per experience (the same browser will use different userids for different stories).
  • timestamp - String ISO timestamp giving time at which the event was sent
  • data - Object with other information about the event (see below for details).
  • playheadTime - Float which records the currentTime according to the current renderer (e.g., playhead time of the video element)

Event Types

Events are classified into the following types:

  • STORY_NAVIGATION - A change in the state of story
  • RENDERER_ACTION - the renderer has done something
  • USER_ACTION - the User has done something
  • SEGMENT_COMPLETION - A NarrativeElement has been completed

Each of these are described in a little more detail below, with the names of all the events that live in each.

STORY_NAVIGATION

namemeaningfromtodata
NARRATIVE_ELEMENT_CHANGEthe story has moved to a new narrative elementprevious NE UUIDnew NE UUIDfromName: previous NE name<br> toName: new NE name
ENTER_SUB_STORYthe story has moved to a new NE with a story bodyprevious NE UUIDnew story UUID-
STORY_ENDthe current (sub) story has endedUUID of NE just finished"END_STORY"-

RENDERER_ACTION

These are events that reflect changes in the renderer. None of these return anything in the data field.

namemeaningfromto
COMPLETE_BEHAVIOUR_PHASE_STARTEDThe renderer has started running end behaviours"not_set""not_set"
DURING_BEHAVIOUR_STARTEDThe renderer has started running a during behaviourbehaviour URI-
SWITCHABLE_REPRESENTATION_SWITCHThe renderer has changed representation in a Switchableprevious Representation namenew Representation name
VIDEO_PAUSEThe renderer has received the instruction to pause"not_set""not_set"
VIDEO_UNPAUSEThe renderer has received the instruction to play"not_set""not_set"
WINDOW_ORIENTATION_CHANGEThe browser has reported a change in window orientation"not_set"window.orientation
BROWSER_VISIBILITY_CHANGEThe browser has reported a change in visibility"visible" or "hidden""hidden" or "visible"
BUTTONS_ACTIVATEDThe renderer has started showing the control bar"not_set""not_set"
BUTTONS_DEACTIVATEDThe renderer has hidden the control bar"not_set""not_set"
BROWSER_CLOSE_CLICKEDThe tab/browser close button has been pressed"not_set""not_set"

USER_ACTION

namemeaningfromtodatanotes
PLAY_PAUSE_BUTTON_CLICKEDThe user has clicked the play/pause button"not_set""not_set"-
SEEK_FORWARD_BUTTON_CLICKEDThe user has clicked the seek forward buttontime seeked fromtime seeked to-
SEEK_BACKWARD_BUTTON_CLICKEDThe user has clicked the seek back buttontime seeked fromtime seeked to-
VIDEO_SCRUBBEDThe user has moved the video scrub bartime scrubbed fromtime scrubbed to-
BACK_BUTTON_CLICKEDThe user has clicked the back button"not_set""not_set"-
NEXT_BUTTON_CLICKEDThe user has clicked the next button"not_set""not_set"-
START_BUTTON_CLICKEDThe user has clicked the start button"not_set""not_set"-
SUBTITLES_BUTTON_CLICKEDThe user has clicked the subtitles button"hidden" or "showing""showing" or "hidden"-
FULLSCREEN_BUTTON_CLICKEDThe user has clicked the fullscreen button"fullscreen" or "not-fullscreen""not-fullscreen" or "fullscreen"-
VOLUME_CHANGEDThe user has changed the position of the volume slidernull[volume label]: new volume level (0-1)-
VOLUME_MUTE_TOGGLEDThe user has pressed the volume mute/unmute buttonnull[volume label]: true (muted) or false (not muted)-
OVERLAY_BUTTON_CLICKEDThe user has clicked a button to toggle an overlay. Current overlays are volume to show volume controls, representation to allow changing Switchable representations, icon to change NE for chapters. A fourth overlay is link-choice, used to render link choices, but this displays programmatically and does not have a button[name]: "hidden" or "visible"[name]: "visible" or "hidden"-
OVERLAY_DEACTIVATEDAn overlay has been de-activated (made invisible)[name]: "visible"[name]: "hidden"-not really a user event
CHANGE_CHAPTER_BUTTON_CLICKEDThe user has clicked an icon in the icon overlay to change NEnullUUID of target Representation-
SWITCH_VIEW_BUTTON_CLICKEDThe user has clicked a representation overlay button to change SwitchablenullUUID of target Representation-
LINK_CHOICE_CLICKEDThe user has clicked a link-choice overlay button to choose a linknullUUID of target NElabel: "Option [id]" <br>text: rendered text or image srcshowlinkchoices/v1.0 behaviour
BEHAVIOUR_CONTINUE_BUTTON_CLICKEDThe user has revisited an experience and chosen to resume"not_set""not_set"-
BEHAVIOUR_CANCEL_BUTTON_CLICKEDThe user has revisited an experience and chosen to restart"not_set""not_set"-
VR_ORIENTATION_CHANGEDThe user has changed view in an immersive (360) viewPrevious direction [phi] [theta]New direction [phi] [theta]phi is latitude - view above/below the equator; theta is longitude - direction left/right. Both in degrees
USER_SET_VARIABLEThe user has changed the value of a variable in a variables panel[variable name]: [old value][variable name]: [new value]showvariablepanel/v1.0 behaviour
VARIABLE_PANEL_NEXT_CLICKEDThe user has clicked the next button in the variable panel"unset"[variable name]: [variable value]-showvariablepanel/v1.0 behaviour
VARIABLE_PANEL_BACK_CLICKEDThe user has clicked the button"unset"[variable name]: [variable value]-showvariablepanel/v1.0 behaviour
SOCIAL_SHARE_CLICKEDThe user has clicked a social media share icon"not_set"Platform id, e.g., "twitter", "facebook"-socialmodal/v1.0 behaviour
OUTWARD_LINK_CLICKEDThe user has clicked an outward link"not_set"URL of linklinkout/v1.0 behaviour

SEGMENT_COMPLETION

Segment completion events are events that are fired each time a Narrative Element completes. They return summary data about user activity during the NE. This is compiled client-side, so should contain all events.

namemeaningfromto
NARRATIVE_ELEMENT_CHANGEA Narrative Element has completedUUID of completed NEUUID of next NE
STORY_ENDThe final Narrative Element in a story has completedUUID of completed NESTORY_END

The SEGMENT_COMPLETION events have a data Object with the following attributes:

  • startTime - UTC time of starting this NE (as number of milliseconds elapsed since January 1, 1970 00:00:00 UTC)
  • chapter - UUID of this NE
  • duration - elapsed time (ms) between NE starting and completing
  • event counts - a set of attributes with the key as the event name (e.g., PLAY_PAUSE_BUTTON_CLICKED) and value of the number of times that event was fired during this NE. Captures all USER_ACTION events.

And the following attributes added in version 0.12.2:

  • pausedTime - total time (ms) that NE was in paused state but not in invisible state
  • hiddenTime - total time (ms) that the browser was not visible while in this NE
  • visibleTime - total time (ms) that the NE was visible
  • playingTime - total time (ms) that the NE was playing

In 0.12.17

  • defaultDuration - the time (in seconds) that the media was planned to last. This is the duration of a piece of timed media (audio, video, or image with duration), and will be null if the representation is not time-bound.

What's inside

4 event type tables (STORY_NAVIGATION, RENDERER_ACTION, USER_ACTION, SEGMENT_COMPLETION) with field descriptions

Change this for your project

  • Replace bbc/storyplayer with your own repository name
  • Replace showlinkchoices/v1.0, showvariablepanel/v1.0, socialmodal/v1.0, linkout/v1.0 with your own behaviour identifiers
  • Replace userid generation logic if not using auto-generated UUIDs

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Worth borrowing

  • Separating events by type (navigation, renderer, user, completion) for clarity
  • Including both event metadata and per-event data fields in a single schema
  • Tracking playhead time and visibility states for detailed user engagement metrics

Related Documents