storybook-addon-datalayer-watcher

Get GTM's dataLayer events in Storybook
20,736 3
Install
npm install storybook-addon-datalayer-watcher
Latest Version:2.0.1
License:MIT
Last Updated:Jun 7, 2025
Links: GitHub  ·  npm
Maintainer: real_ouss

storybook-addon-datalayer-watcher

Installation

First, install the package.

npm install --save-dev storybook-addon-datalayer-watcher

Then, register it as an addon in .storybook/main.js.

// .storybook/main.ts

// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';

const config: StorybookConfig = {
  // ...rest of config
  addons: [
    '@storybook/addon-essentials'
    'storybook-addon-datalayer-watcher', // 👈 register the addon here
  ],
};

export default config;

Usage

This addon allows you to debug GTM dataLayer events in Storybook.

If your component pushes to the dataLayer array (directly or using a library), you can interact with it in Storybook and see the GTM events it triggers.

Demo image

Storybook versions support

This addon supports all versions of Storybook starting 7.0

Please see the table bellow to see which addon version supports which Storybook versions.

Version Supported Storybook versions
1.x >= 7.0, < 9.0
2.x >= 9.0

Credits

Thanks @cmarcchen for the idea

Related Packages

vue-logger

the logger module for Vue.js

8,223 14
storybook-addon-vue-slots

Vue Slots support for Storybook

491,750 22
@dreipol/vue-log

This npm package provides a system of log enhancements for vue applications.

7,319 7
storybook-vue-slots

Vue Slots support for Storybook

26,123

Version History

Version Released License
2.0.1 MIT
1.0.2 MIT
1.0.1 MIT