Skip to main content
MybringDesign System

Data and statistics

What are users doing?

All parts of Mybring should have a basic level of usage logging. What basic level includes might vary in the different areas of Mybring, but this general list works as a starting guide.

Siteimprove is available in all parts of Mybring through Tagmanager in Mybring Layout. Out of the box, this collects standard web statistics like page views, viewport resolution, operating system, etc.

If you are building applications without Mybring Layout or the Tagmanager script, the Siteimprove script must be included manually – contact Mybring Experience for more directions.

Logging usage

Siteimprove

In addition to the automatically collected web statistics, it is recommended that all parts of Mybring collect useful information about usage. Generally, this should be done through event logging, as opposed to the automatic navigation logging, in Siteimprove.

Basic event logging

It is recommended to log the following user actions:

Detailed event logging

Basic logging is not always enough to answer all questions required to make good decisions. More detailed logging can can be continuous or temporary based on what we want to find out and the nature of the planned changes. The information needed will be specific to the task at hand, but can still follow the recommendations and categories for basic logging.

Parameters and category values

Event logging requires three parameters, or properties: Category, action and label. Values for action and label are not predefined, but for the category parameter, you should use one of the following predefined values.

Category values
Category Description
Task For counting the use of user tasks.
Setting For configurations like dark/light mode, language, etc.
Flow step For tracking different elements of a flow that makes up a user task. Remember to also log a task on completing the flow
UI-Change For temporary changes to the UI. Filtering, expanding, hiding, sorting etc.
Conditional view For counting how often an element which is only shown under certain sircumstanses are shown.
Error message For logging of which error messages that are shown and where.
Administration Mainly useful in the User Admin application.

Action and label values

For the action property, try to describe what happened from the user’s perspective. “Ordered shipment” or “Downloaded report” are examples of good values.

The “Label” property identifies which element on the page has been interacted with. It is often better to make a specific logging value than to use the actual label on the element. “Next” or “34” do not provide good information about what has happened for anyone trying to read the statistics.

Good and bad logging values
What a user does Category Action Label
Opens an invoice Task Views an invoice View invoice
View {Invoice number}
Clicks Next in an order wizard Flow step* Order shipment wizard Confirm sender & recipient info
Complete step Next
Navigates to page 34 in a pagination UI change Navigates the {something}-table Go to page {number} in pagination
Navigates table 34
Orders Task Order pick up Confirm order
Order Confirm

Set up logging

In addition to the Siteimprove script, Mybring Layout also has a script that simplifies event logging. The script is served from the design system, so it can also be used in applications that don’t use Mybring Layout. The script is a function SiteImprove.registerEvent() that takes an object with the three values, it’s placed in the function related to the triggered event. Keep in mind the logical order of this against validation, so that events aren’t logged if their validation fails.

const toggleTiles = (label) => {
  setConfiguringTiles(!configuringTiles)

  if (typeof SiteImprove !== 'undefined') {
    SiteImprove.registerEvent({
      category: 'UI change',
      action: 'Configure navigation entrances',
      label: label
    })
  }
}
onClick={() => {
  toggleTiles('Open entrance configuration');
}}
TypeScript

Add the following to conf.d.ts

interface RegisterEvent {
  category: string
  action: string
  label: string
  event?: string
}

declare namespace SiteImprove {
  function registerEvent(RegisterEvent: RegisterEvent): void
}

When logging in production

Check the numbers a few days after putting your logging into production. It’s not easy to get it all correct the first time. You might not be able to verify the numbers completely, but here are some tips to see if the logging needs adjustments:

Logging performance and state

We use Grafana to log data to measure performance, API-speeds, number of request from one API to another, which pod has the greatest load, etc. Generally a live view of the condition of the applications.

Consider which values are relevant to log for your application.