1.2.2 • Published 3 years ago

optimove-websdk v1.2.2

Weekly downloads
411
License
MIT
Repository
github
Last release
3 years ago

optimove-websdk

Optimove WebSDK for humans

npm min.gz size code style: prettier

Why

Because Optimove is complicated™

Features

  • Promisified API
  • Reasonable defaults
  • Typescript types built-in
  • Bundled, so e.g. ad-blockers won't block it just by url name
  • Loads config with hard-coded https:// schema, which allows it to work under e.g ionic://, capacitor://, file://, etc schemas
  • Allows to not care about optimoveSDK.initialize, since it's called lazily on first usage.
  • Allows to (hopefully) not care about "is it loaded yet?" problem
  • Zero dependencies (1 small tree-shakeable dependency), exports ESM / 🌲-shakeable
  • Automatically handles snakeToCamel, camelToSnake case conversions when reporting events and custom properties

Usage

import { OptimoveWebSK } from 'optimove-websdk'

const sdk = new OptimoveWebSDK({
  tenantToken: 'lalala',
  configVersion: '1.0.0',
})

// Will lazily initialize SDK on the first call (hence the `await`)
await sdk.registerUser('someCustomerId', 'some@email.com')

// Skip await freely, if it's more convenient
void sdk.registerUser('someCustomerId', 'some@email.com')

// Low-level API is available via `window.optimoveSDK` too (Window interface is augmented with its types already)
window.optimoveSDK.API.registerUser('someCustomerId', 'some@email.com')
1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.6

3 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago