BBC's guide to development
  • General

    • About
    • Tools
    • Git(hub)
    • Showpad
    • Hosting
    • Maintenance
    • Security
    • Go live checklist
  • Front-end development

    • Bundlers
    • CSS/SCSS
    • Javascript
    • Vue
    • PHP
    • Mails
    • Dev Faq
  • Functions
  • Mixins
  • General

    • OOP Structure
  • Component Classes

    • Accordion
    • App
    • Component
    • HighwayApp
    • Popup
    • PNG Sequencer
    • Tab
  • Manager Classes

    • BountListenerMgr
    • Cache
    • Configuration
    • InViewStateMgr
    • Instance Manager
    • Event dispatcher
  • Factories

    • SwiperFactory
  • PDF

    • AssetLoader
    • BasePdfDoc
    • TemplatePdfDoc
    • CustomPdfDoc
  • Utility functions

    • canvas
    • Connection Status
    • css
    • dev
    • placeholder
    • dom
    • fetch
    • json
    • object
    • scroll
    • scrollbar
    • spreadsheets
    • string
    • url
  • General

    • ComponentMgr
    • ThreeJsViewer
  • Components

    • ComponentMgr
    • GltfModel
    • Snappable
    • Socket
    • ThreeJsViewer
    • ThreeJsViewerCamera
  • Loaders

    • ConfigurationSerializer
    • GltfBlockParser
  • Utils

    • CanvasInputAdapter
    • CollisionManager
    • SocketGridExpander
    • blender
    • headless
  • General

    • Troubleshooting
    • Legacy
  • Components

    • AssetBar
    • ConfigGenerator
    • ShowpadApp
  • Managers

    • Assets
    • AppsDb
    • Config
  • Utils

    • Connection Status
    • general
    • showpad-interactive
    • showpad-upload
  • Components

    • Accordion
    • BackButton
    • Breadcrumb
    • ByltButton
    • Hamburger
    • Icon
    • Logo
    • Loader
    • Modal
    • Popup
    • Prompt
    • ProgressBar
    • TextLoader
  • Composables

    • useDebugMode
    • useConnectionStatus
  • Utils

    • dom
    • props
  • General

    • General
    • Tracking
  • Components

    • Accordion
    • ActionButton
    • AssetItem
    • AssetList
    • BackButton
    • ConfigGenButton
    • Logo
    • Media
    • Modal
    • Popup
    • Prompt
    • SPButton
    • SPRouterView
    • SPTrackedRouterLink
    • TextLoader
    • View
  • Composables

    • useConnectionStatus
  • Stores

    • useAppsDbStore
    • useBreadcrumbStore
    • useShowpadAPIStore
    • useShowpadSDKStore
    • useSpConfigStore
    • useSpStore
    • useSpTrackingStore
  • The New Kit

    • General
    • Installation & Usage
    • ACF Blocks
    • PHPCS
    • Functions
    • Vite
    • WP Config
    • Staging Deployment
  • Best Practices

    • Page Structure
    • Fonts/Typography
  • Todo
GitHub
  • General

    • About
    • Tools
    • Git(hub)
    • Showpad
    • Hosting
    • Maintenance
    • Security
    • Go live checklist
  • Front-end development

    • Bundlers
    • CSS/SCSS
    • Javascript
    • Vue
    • PHP
    • Mails
    • Dev Faq
  • Functions
  • Mixins
  • General

    • OOP Structure
  • Component Classes

    • Accordion
    • App
    • Component
    • HighwayApp
    • Popup
    • PNG Sequencer
    • Tab
  • Manager Classes

    • BountListenerMgr
    • Cache
    • Configuration
    • InViewStateMgr
    • Instance Manager
    • Event dispatcher
  • Factories

    • SwiperFactory
  • PDF

    • AssetLoader
    • BasePdfDoc
    • TemplatePdfDoc
    • CustomPdfDoc
  • Utility functions

    • canvas
    • Connection Status
    • css
    • dev
    • placeholder
    • dom
    • fetch
    • json
    • object
    • scroll
    • scrollbar
    • spreadsheets
    • string
    • url
  • General

    • ComponentMgr
    • ThreeJsViewer
  • Components

    • ComponentMgr
    • GltfModel
    • Snappable
    • Socket
    • ThreeJsViewer
    • ThreeJsViewerCamera
  • Loaders

    • ConfigurationSerializer
    • GltfBlockParser
  • Utils

    • CanvasInputAdapter
    • CollisionManager
    • SocketGridExpander
    • blender
    • headless
  • General

    • Troubleshooting
    • Legacy
  • Components

    • AssetBar
    • ConfigGenerator
    • ShowpadApp
  • Managers

    • Assets
    • AppsDb
    • Config
  • Utils

    • Connection Status
    • general
    • showpad-interactive
    • showpad-upload
  • Components

    • Accordion
    • BackButton
    • Breadcrumb
    • ByltButton
    • Hamburger
    • Icon
    • Logo
    • Loader
    • Modal
    • Popup
    • Prompt
    • ProgressBar
    • TextLoader
  • Composables

    • useDebugMode
    • useConnectionStatus
  • Utils

    • dom
    • props
  • General

    • General
    • Tracking
  • Components

    • Accordion
    • ActionButton
    • AssetItem
    • AssetList
    • BackButton
    • ConfigGenButton
    • Logo
    • Media
    • Modal
    • Popup
    • Prompt
    • SPButton
    • SPRouterView
    • SPTrackedRouterLink
    • TextLoader
    • View
  • Composables

    • useConnectionStatus
  • Stores

    • useAppsDbStore
    • useBreadcrumbStore
    • useShowpadAPIStore
    • useShowpadSDKStore
    • useSpConfigStore
    • useSpStore
    • useSpTrackingStore
  • The New Kit

    • General
    • Installation & Usage
    • ACF Blocks
    • PHPCS
    • Functions
    • Vite
    • WP Config
    • Staging Deployment
  • Best Practices

    • Page Structure
    • Fonts/Typography
  • Todo
GitHub
  • Showpad tracking

Showpad tracking

Most of our Showpad Experiences have tracking requirements. Some Showpad Vue components have tracking build in.

Components with tracking will have a Tracking tag in the documentation next to the name.

All components with tracking will follow the same API to avoid confusion. Tracking descriptions will have a default value related to the type of component so they don't always need to be provided when used in projects.

Getting started

Most components will provide default values for the tracking propeties, so they don't need to be provided every time they are used in projects. But all tracking properties can be overridden if necessary.

Example of a generic vue component with tracking

<template>
    <comp
        :track="true"
        :trackLabel="Custom tracking label"
        :trackCategory="Custom tracking category"
    />
</template>

Add tracking to custom component

Custom components may require tracking too. To do so, they need to import useSpTrackingStore and try to follow the same structure as the other components in the kit and the project.

Guidelines

  • Every trackable component must provide the three tracking properties so the values can be overridden when needed without having to refactor the component's codebase
  • Every tracking property must follows the same naming convention as the kit.
  • Default values may be provided by the component but they must be editable using the properties if the developer using that component deems so necessary.

API of Kit components

Properties

track

Flag to toggle tracking. If set to false, no tracking will be triggered when the user interacts with that component

Values: Boolean

Default: true (most of the time)

trackCategory

Category in which the tracking needs to be logged. Necessary for the readouts of the tracking to know which type of component or scenario the action belongs to.

Most trackable components have this value predefined based on the type of component they are.

Values: String

Default: 'button' (most components)

trackLabel

The label/title the action needs to be tracked under.

Some components will have this prefilled automatically if no value is provided — for example, SPButton falls back to the button's rendered text.

Values: String

Default: null (component specific)

Tracking defaults per component

Componenttrack defaulttrackCategory defaulttrackLabel default
Logotrue'button''Logo'
SPButtontrue'button'rendered label text
SPTrackedRouterLinktrue'button'null
Popuptrue——
Modalfalse——
Promptfalse——
BackButtontrue (via SPTrackedRouterLink)'button'null

init() must be called before tracking fires

All tracking calls are silently blocked if useSpTrackingStore has not been initialized. Call trackingStore.init() once after useSpStore.init() has resolved — user and device info must be available before the session can be created. Events fired before this point produce a console warning and are dropped.

Wiring tracking in your app

The typical setup initializes tracking after the Showpad store is ready and registers a router guard for pageview events:

import { useSpStore, useSpTrackingStore } from '@bbc/front-end-kit/vue/showpad'

const spStore = useSpStore()
const trackingStore = useSpTrackingStore()

trackingStore.experienceType = 'product-catalog'
trackingStore.clientName = 'Acme Corp'
trackingStore.appName = 'Sales App'

await spStore.init()
trackingStore.init()

router.afterEach((to, from) => {
    trackingStore.trackPageviewEvent({ from, to })
})
Edit this page
Last Updated: 4/27/26, 12:56 PM
Contributors: Nicolas Jaenen