# clevertap-web

> Wrapper to integrate CleverTap Web SDK with any SPA (React, Vue, Angular)

Latest version **1.0.3** (published 2021-12-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install clevertap-web
pnpm add clevertap-web
yarn add clevertap-web
bun add clevertap-web
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2021-12-16 |
| First published | 2021-12-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mohammed Mudassir |
| Maintainers | mdmudassir |
| Keywords | clevertap-web, clevertap-react, clevertap-angular, clevertap-vue |

## Links

- npm: https://www.npmjs.com/package/clevertap-web
- Repository: https://github.com/Md-Mudassir/clevertap-web
- Homepage: https://github.com/Md-Mudassir/clevertap-web#readme
- Issues: https://github.com/Md-Mudassir/clevertap-web/issues
- npm.io page: https://npm.io/package/clevertap-web

## Dependencies (1)

- [clevertap-web](https://npm.io/package/clevertap-web.md) ^1.0.1

## Recent versions

- 1.0.3 (latest) — 2021-12-16
- 1.0.2 — 2021-12-16
- 1.0.1 — 2021-12-16
- 1.0.0 — 2021-12-16

## README

# clevertap-web

Wrapper to integrate CleverTap Web SDK with any SPA (React, Vue, Angular).

**Note:** Events will not be caputed on localhost, events are only captured on production.

- Implementation Example (React)
  [React-CleverTap-Example](https://github.com/Md-Mudassir/react-clevertap-example)

### Usage

- Installation `npm install -D clevertap-web`
- Initialize in your root

```js
import CleverTapWeb from 'clevertap-web';

CleverTapWeb.initialize('CLEVERTAP_ACCOUNT_ID');
```

### API

- Identify Users

```js
import CleverTapWeb from 'clevertap-web';

// with the exception of one of Identity, Email, or FBID
// each of the following fields is optional

CleverTapWeb.onUserLogin({
  Site: {
    Name: 'Jack Montana', // String
    Identity: 61026032, // String or number
    Email: 'jack@gmail.com', // Email address of the user
    Phone: '+14155551234', // Phone (with the country code)
    Gender: 'M', // Can be either M or F
    DOB: new Date(), // Date of Birth. Date object
    // optional fields. controls whether the user will be sent email, push etc.
    'MSG-email': false, // Disable email notifications
    'MSG-push': true, // Enable push notifications
    'MSG-sms': true, // Enable sms notifications
    'MSG-whatsapp': true, // Enable WhatsApp notifications
  },
});
```

- Push Event

```js
import CleverTapWeb from 'clevertap-web';

var payload = {
  'Product name': 'Casio Chronograph Watch',
  Category: 'Mens Accessories',
  Price: 59.99,
};

CleverTapWeb.event('Product Viewed', payload);

// Payload is optional, if you dont want to pass it, you can just do
CleverTapWeb.event('Product Viewed');
```

- Profile Push

```js
import CleverTapWeb from 'clevertap-web';

var payload = {
  Site: {
    Name: 'Jack Montana', // User's name
    Age: 28,
  },
};

CleverTapWeb.profile(payload);
```

- Logout

```js
import CleverTapWeb from 'clevertap-web';

CleverTapWeb.logout();
```

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