tagLink

Tags a TaggableElement to be tracked as LinkContext.

tagLink = (parameters: {
id: string,
href: string,
options?: TagLocationOptions,
onError?: TrackerErrorHandlerCallback
}) => TagLocationReturnValue

Parameters

typedefault value
requiredidstring
requiredhrefstring
optionaloptionsTagLocationOptions{ trackClicks: true }
optionalonErrorTrackerErrorHandlerCallbackTrackerConsole.error

Returns

TagLocationReturnValue

Events

Unless customized via the options parameter, automatically triggers:

Usage examples

import { tagLink } from '@objectiv/tracker-browser';
<a {...tagLink({ id: 'lnk-id', href: '/path' })} href="/path">Go!</a>
<LinkComponent {...tagLink({ id: 'lnk-id', href: '/path' })} to="/path">Go!</LinkComponent>

Did you know ?

tagLink is just syntactic sugar on top of tagLocation.