tagLink
Tags a TaggableElement to be tracked as LinkContext.
tagLink = (parameters: {
id: string,
href: string,
options?: TagLocationOptions,
onError?: TrackerErrorHandlerCallback
}) => TagLocationReturnValue
Parameters
type | default value | ||
---|---|---|---|
required | id | string | |
required | href | string | |
optional | options | TagLocationOptions | { trackClicks: true } |
optional | onError | TrackerErrorHandlerCallback | TrackerConsole.error |
Returns
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.