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

@growthbook/growthbook

Package Overview
Dependencies
Maintainers
0
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@growthbook/growthbook

[GrowthBook](https://www.growthbook.io) is an open source Feature Flagging and Experimentation platform.

  • 1.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
273K
increased by4.78%
Maintainers
0
Weekly downloads
 
Created

What is @growthbook/growthbook?

@growthbook/growthbook is a feature flagging and A/B testing library that helps you manage feature releases and run experiments to understand the impact of changes on your users. It provides tools for feature toggling, experimentation, and analytics integration.

What are @growthbook/growthbook's main functionalities?

Feature Flagging

This feature allows you to toggle features on and off. The code sample demonstrates how to check if a feature flag is enabled or disabled.

const { GrowthBook } = require('@growthbook/growthbook');

const growthbook = new GrowthBook({
  features: {
    'new-feature': {
      defaultValue: false
    }
  }
});

if (growthbook.isOn('new-feature')) {
  console.log('New feature is enabled');
} else {
  console.log('New feature is disabled');
}

A/B Testing

This feature allows you to run A/B tests by defining variations and their weights. The code sample shows how to get the variation assigned to a user for a given experiment.

const { GrowthBook } = require('@growthbook/growthbook');

const growthbook = new GrowthBook({
  features: {
    'experiment-1': {
      variations: [
        { value: 'A', weight: 0.5 },
        { value: 'B', weight: 0.5 }
      ]
    }
  }
});

const variation = growthbook.getFeatureValue('experiment-1', 'A');
console.log(`User is in variation: ${variation}`);

Analytics Integration

This feature allows you to integrate with analytics platforms by providing a callback function that gets called whenever an experiment is run. The code sample demonstrates how to log experiment results.

const { GrowthBook } = require('@growthbook/growthbook');

const growthbook = new GrowthBook({
  trackingCallback: (experiment, result) => {
    console.log(`Experiment: ${experiment.key}, Variation: ${result.variationId}`);
  }
});

growthbook.run({
  key: 'experiment-1',
  variations: [
    { value: 'A', weight: 0.5 },
    { value: 'B', weight: 0.5 }
  ]
});

Other packages similar to @growthbook/growthbook

FAQs

Package last updated on 21 Feb 2025

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