Development approach

This is our high-level approach to implementing tracking across our applications.

  • For elements that are consistent from page to page (such as the header, footer and breadcrumbs) tracking should be enabled by default.
  • For elements within the content of a page, tracking should be controllable. Specifically, tracking should be disabled on components by default and then enabled with the ‘ga4_tracking: true’ option. This provides the flexibility to disable tracking in the unforeseen event of some kind of tracking collision or duplication.
  • For elements that are inside content coming from a publishing interface, such as govspeak elements, tracking should be decided on a case by case basis. The most likely approach would be to enable tracking by default. This removes the need to provide publishers with an option to enable tracking on their content, which could get much more complex.

Enabling tracking should be as simple as possible. For this reason, tracking should be handled internally by components unless external data is required, that is, unless something unique must be passed from the application to the component to track it correctly.