@r/google-tag-manager
v0.2.7
Published
A wrapper for google tag manager with a builtin jail.
Downloads
23
Readme
r/google-tag-manager
A wrapper for google tag manager with a builtin jail.
Change Log
v0.0.0
Initial release
v0.1.0
- Allow
payload
to override default data layer variables - Replace
host
withjailUrl
and make it required.
v0.2.0
- Include additional location / referrer data in default payload.
v0.2.2
- Update @r/frames dependency
v0.2.3
- Queue events until to
loaded
event returns from jail.
v0.2.6
- Release assets are packaged with the build, rather than compiled upon install
v0.2.7
- Updates @r/frames so that this package will not break server environments
Installation
yarn add @r/google-tag-manager -s
Usage example
import * as gtm from '@r/google-tag-manager';
// initialize gtm
gtm.setup({
containerId: 'GTM-XXXXXX',
host: 'redditmedia.com',
payload: {
user: 1234,
subreddit: 'WhatsSnoo',
},
});
// trigger events (payload optional)
gtm.trigger('pageview', {
subreddit: 'announcements',
});
gtm.trigger('loggedout');
TODO
- Add tests
- Convert to typescript