@elbwalker/tagger
v2.1.2
Published
A helper to set up tracking based on walkerOS
Downloads
10,173
Maintainers
Readme
Tagger
Made to be used with @elbwalker/walkerOS.
More detailed information and examples can be found in the documentation.
🤓 Usage
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', 'impression'); // { "data-elbaction": "visible:impression" }
tagger.action({ click: 'add', load: 'view' }); // { "data-elbaction": "click:add;load:view" }
tagger.property('promo', 'text', 'hey'); // { "data-elb-promo": "text:hey" }
tagger.property('promo', { id: '1', text: 'hey' }); // { "data-elb-e": "id:1;text:hey" }
tagger.context('test', 'a'); // { "data-elbcontext": "test:a" }
tagger.context({ test: 'a', pos: 'hero' }); // { "data-elbcontext": "test:a;pos:hero" }
tagger.globals('language', 'en'); // { "data-elbglobals": "language:en" }
tagger.globals({ language: 'de', pagegroup: 'shop' }); // { "data-elbglobals": "language:de;pagegroup:shop" }
Contribute
Feel free to contribute by submitting an issue, starting a discussion or getting in contact.