Skip to main content

    Analytics

    When creating a new page or new feature there might be a need to add analytics to capture events on page. In our code base you will find 2 files that relate to analytics.

    • /src/platform/startup/analytics-middleware.js
    • /src/platform/monitoring/record-event.js

    analytics-middleware.js

    This file is a plugin for MetalSmith. This is where the google analytics is initialized. Events will get pushed to a window.dataLayer then evaluated then sent to our analytics service.

    record-event.js

    This file is our utility functions for recording analytical events. You will want to use these functions for recording events on your page. The recordEvent function will take in an object with an event property like so.

    recordEvent({
      event: 'your-event-name',
    })
    

    The event name is determined by your analytics team, so please make sure you communicate with them to make sure you are using the correct event.