The Tagger is a helper to generate the data-elb attributes.
The Tagger will support tagging validation and other features soon. It's worth using it.
Start by installing the tagger with npm:
npm i --save @elbwalker/tagger
Import, instantiate and use the tagger
import Tagger from '@elbwalker/tagger';
const tagger = Tagger();
tagger.entity('promotion'); // { "data-elb": "promotion" }
tagger.action('visible', 'view'); // { "data-elbaction": "visible:view" }'promotion', 'category', 'analytics'); // { "data-elb-promotion": "category:analytics" }
tagger.context('test', 'engagement'); // { "data-elbcontext": "test:engagement" }
tagger.globals('language', 'en'); // { "data-elbglobals": "language:en" }
You can use the return values to add them directly to your HTML. Use the spread operator in React:
{...tagger.action('visible', 'view')}
{'promotion', 'name', 'Setting up tracking easily')}

Contact us

For more information on any of the things covered in this documentation, you can