SPTrackedRouterLink Tracking
Extends RouterLink
import { SPTrackedRouterLink } from '@bbc/front-end-kit/vue/showpad'
Adds tracking to the original RouterLink component of VueRouter.
Getting started
<template>
<div>
<SPTrackedRouterLink :to="{ name: 'home' }">Home</SPTrackedRouterLink>
</div>
</template>
<script setup>
import { SPTrackedRouterLink } from '@bbc/front-end-kit/vue/showpad'
</script>
API
This component extends from RouterLink. All attributes will be passed on to that parent component unless documented here.
Tracking
On click, fires a trackClickEvent via useSpTrackingStore. Tracking is on by default.
Properties
track
Whether to fire a tracking event on click.
Values: Boolean
Default: true
trackCategory
The category sent with the tracking event.
Currently ignored
Despite being configurable, the source currently hardcodes category: 'button' in the tracking call. This prop has no effect until the source is fixed.
Values: String
Default: 'button'
trackLabel
The label sent with the tracking event. When null, the tracking call receives no label.
Values: String
Default: null
Slots
No additional slots next to RouterLink.