Skip to main content

tagElement

Tags a TaggableElement to be tracked as SectionContext.

tagElement = (parameters: {
id: string,
options?: TagLocationOptions,
onError?: TrackerErrorHandlerCallback
}) => TagLocationReturnValue
Element vs Section

Our Taxonomy names a logical UI unit as Section. We felt this would be confusing in Browser's world, hence Element.

Parameters

typedefault value
requiredidstring
optionaloptionsTagLocationOptions{ trackVisibility: { mode: 'auto' } }
optionalonErrorTrackerErrorHandlerCallbackconsole.error

Returns

TagLocationReturnValue

Events

Unless customized via the options parameter, automatically triggers:

Usage example

import { tagElement } from '@objectiv/tracker-browser';
<Layout {...tagElement({ id: 'layout' })}>
<div {...tagElement({ id: 'section' })}>
...
</div>
</Layout>

Did you know ?

tagElement is just syntactic sugar on top of tagLocation.