TrackedMain

Generates a <main> Element wrapped in a ContentContext identified as main, unless differently specified.

TrackedMain: (props: {
objectiv?: {
id?: string,
normalizeId?: boolean,
}
}) => <main>

objectiv prop attributes

typedefault value
optionalidstringinferred from native id or title, fallback to main
optionalnormalizeIdbooleantrue
info
  • When the id attribute is omitted, we attempt to infer it from one of the elements' native props: id or title.

If that fails, we fallback to main.

Returns

<main>

Automatic Events

None.

Usage example

import { TrackedMain } from '@objectiv/tracker-react';

<div>
<header>
...
</header>
<TrackedMain>
...
</TrackedMain>
<TrackedMain id={'Main Section'}>
...
</TrackedMain>
<TrackedMain objectiv={{ id: 'Another Main Section' }}>
...
</TrackedMain>
<footer>
...
</footer>
</div>

By default, all Tracked Elements automatically normalize their Context identifiers to a kebab-cased format.

This can be disabled via the normalizeId option:

import { TrackedMain } from '@objectiv/tracker-react';

<div>
<TrackedMain objectiv={{ id: 'Main Section', normalizeId: false }}>
...
</TrackedMain>
</div>

Did you know ?

TrackedMain internally uses TrackedContentContext.