# leanplum-sdk

> The JavaScript SDK for Leanplum allows developers to integrate the Leanplum platform with applications that use JavaScript and HTML5. Leanplum is an customer engagement platform that provides mobile A/B testing, messaging, and personalization features for

Latest version **1.14.0** (published 2025-10-27) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install leanplum-sdk
pnpm add leanplum-sdk
yarn add leanplum-sdk
bun add leanplum-sdk
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.14.0 |
| Published | 2025-10-27 |
| First published | 2017-07-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Leanplum Inc. |
| Maintainers | leanplum |
| Keywords | leanplum, sdk, analytics, push, notifications, messaging |

## Links

- npm: https://www.npmjs.com/package/leanplum-sdk
- Repository: https://github.com/Leanplum/Leanplum-JavaScript-SDK
- Homepage: https://github.com/Leanplum/Leanplum-JavaScript-SDK#readme
- Issues: https://github.com/Leanplum/Leanplum-JavaScript-SDK/issues
- npm.io page: https://npm.io/package/leanplum-sdk

## Dependencies (1)

- [clevertap-web-sdk](https://npm.io/package/clevertap-web-sdk.md) 2.3.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.14.0 (latest) — 2025-10-27
- 1.14.0-develop.1 (beta) — 2025-10-25
- 1.13.0 — 2024-09-13
- 1.12.0 — 2024-06-28
- 1.12.0-develop.1 — 2024-06-28
- 1.11.3 — 2023-08-22
- 1.11.3-develop.1 — 2023-08-22
- 1.11.2 — 2023-08-21
- 1.11.2-develop.1 — 2023-08-21
- 1.11.1 — 2023-07-26
- 1.11.1-develop.1 — 2023-07-26
- 1.11.0 — 2023-04-29
- 1.11.0-develop.12 — 2023-04-14
- 1.11.0-develop.11 — 2023-04-13
- 1.11.0-develop.10 — 2023-04-13
- … 43 more at https://npm.io/package/leanplum-sdk/versions

## README

![Leanplum - ](Leanplum.svg)

<p align="center">
<a href="https://nodei.co/npm/leanplum-sdk/"><img src="https://nodei.co/npm/leanplum-sdk.png?downloads=true&downloadRank=true&stars=true"/></a>
</p>
<p align="center">
<img src="https://badge.fury.io/js/leanplum-sdk.svg"/>
<a href="https://raw.githubusercontent.com/Leanplum/Leanplum-iOS-SDK/master/LICENSE"><img src="https://img.shields.io/badge/license-apache%202.0-blue.svg?style=flat" alt="License: Apache 2.0" /></a>
</p>


# Leanplum JavaScript SDK

This is the JavaScript SDK for Leanplum, allowing developers to access and integrate the functionality of Leanplum with applications and devices through JavaScript and HTML5.

Leanplum is a marketing cloud platform that provides A/B testing, messaging, and personalization features for applications.

## Installation

### As a static script

Add leanplum.js to your project:

```javascript
<script src="https://unpkg.com/leanplum-sdk@1.3.0/dist/leanplum.min.js"></script>
```

### As a NPM module

1. Install the package with

    ```bash
    npm install leanplum-sdk
    ```

2. Use the package in your project

    ```javascript
    import Leanplum from 'leanplum-sdk';
    ```

## Usage

```javascript
// This value should be set to true only if you're developing on your server.
var isDevelopmentMode = true;

// Sample variables. This can be any JSON object.
var variables = {
  items: {
    color: 'red',
    size: 20,
    showBadges: true
  },
  showAds: true
};

// Insert your API keys here.
if (isDevelopmentMode) {
  Leanplum.setAppIdForDevelopmentMode("APP_ID", "DEVELOPMENT_KEY");
} else {
  Leanplum.setAppIdForProductionMode("APP_ID", "PRODUCTION_KEY");
}

Leanplum.setVariables(variables);
Leanplum.start(function(success) {
  console.log('Success: ', success);
  console.log('Variables: ', Leanplum.getVariables());
});
```

For a complete reference on how to use the Leanplum JavaScript SDK, refer to the [developer documentation](https://docs.leanplum.com/reference#javascript-setup).

## Development

### Setup

Install yarn package manager and run have it install all dependencies.

```bash
npm i -g yarn
yarn install
```

### Tasks

- `yarn start` - Starts Webpack in development/watch mode.
- `yarn lint` - Lints all files.
- `yarn build` - Builds a distribution version of the library.
- `yarn test` - Runs the unit tests.

## Contributing

Before making a contribution, please read through the [contribution guidelines](https://github.com/Leanplum/Leanplum-JavaScript-SDK/blob/master/CONTRIBUTING.md).

Once you have done that:

1. Fork the project
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin feature/my-new-feature`
5. Submit a pull request to the develop branch

## Release / Building

```bash
git flow release start "NEW_VERSION"
yarn install
./bump_version.sh OLD_VERSION NEW_VERSION
yarn build
yarn test
git flow release finish "NEW_VERSION"
```

# Test Coverage

Run:
```bash
yarn test --coverage
```

## License

See the [LICENSE](https://github.com/Leanplum/Leanplum-JavaScript-SDK/blob/master/LICENSE) file.

---
_Source: https://npm.io/package/leanplum-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
