New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@quintoandar/storybook-amplitude

Package Overview
Dependencies
Maintainers
10
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quintoandar/storybook-amplitude

Storybook Addon for Amplitude

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
10
Weekly downloads
 
Created
Source

Storybook Addon Amplitude

Storybook Addon Amplitude provides support for Amplitude on Storybook.

Getting Started

Install:

npm install storybook-amplitude --save-dev

within .storybook/main.js:

module.exports = {
  addons: ['storybook-amplitude/register']
};

Then, set on window object a key STORYBOOK_AMPLITUDE_API_KEY using your API key as value:

window.STORYBOOK_AMPLITUDE_API_KEY = 'YOUR_API_KEY_HERE'

Configuration

You can use a custom event name and identify each event with an email by setting the following values on window object:

window.STORYBOOK_AMPLITUDE_EVENT = 'Your custom event'
window.USER_EMAIL = 'email'

The default value for STORYBOOK_AMPLITUDE_EVENT is Story Viewed.

Event anatomy

lt;dr: the event will be sent with Story Viewed (or your custom event name) and the custom property object with viewMode, group, page and story.

The Storybook provides just the path and storyId on the api provided by register callback. The strings are like these examples:

  • /story/fundamentals-principles--page
  • /docs/design-spacing--page
  • /docs/components-accordion--base
  • /story/components-accordion--base

So, we've split the path and created an object with this anatomy:

/<viewMode>/<group>-<page>--<story>

Examples:

PathViewModeGroupPageStory
/story/fundamentals-principles--pagestoryfundamentalsprinciplesnull
/docs/design-spacing--pagedocsdesignspacingnull
/docs/components-accordion--basedocscomponentsaccordionbase
/story/components-button--disabledstorycomponentsbuttondisabled

Creating an util function that returns an object with viewMode, group, page and story. Something like this:

{
  viewMode: 'docs',
  group: 'components',
  page: 'button',
  story: 'disabled'
}

Support

Do you need a help? Open a issue here!

Keywords

FAQs

Package last updated on 13 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc