lemnisk-react-native
TypeScript icon, indicating that this package has built-in type declarations

0.1.14 • Public • Published

lemnisk-react-native

Lemnisk React Native Integration guide

Installation

npm install --save lemnisk-react-native

and then run the following command to update the Pods in your Project's ios directory

pod install

Note: If you are using React Native version below 0.60, then please run the following command to link the Lemnisk ReactNative SDK

react-native link lemnisk-react-native

Usage

Please import Lemnisk native module in your react-native application.

import LemniskSdk from 'lemnisk-react-native';

Now, you can log an event to Lemnisk by using the following method call in your react-native application.

Identify

The identify call lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about the user, like their email, mobile, any other id etc.

LemniskSdk.identify('<userId>', {traits}, {otherIds})

The identify call has the following fields:

Parameter Type Data Type Description
userId optional String The tokenized database ID for the user. If you don’t know who the user is yet, you can omit the userId and just record traits.
traits optional Object A dictionary of other user that you know about the user, like firstName, lastName, gender, location, address etc.
otherIds optional Object A dictionary of other user identities you know about the user, like email or mobile or any other identifier

Example identify call:

LemniskSdk.identify('crmid1234', {
	"firstName": "John",
	"lastName": "Miller",
	"gender": "Male",
  }, {
	    "email": "john@gmail.com"
  })

Track

The track call lets you record any actions your users perform, along with any properties that describe the action.

LemniskSdk.identify('<event>', {properties}, {otherIds})

The track call has the following fields:

Parameter Type Data Type Description
event optional String The name of the event you’re tracking.
properties optional Object A dictionary of properties for the event. If the event was 'Product View', it might have properties like productName, price and productCategory.
otherIds optional Object A dictionary of other user identities you know about the user, like email or mobile or any other identifier

Example track call:

LemniskSdk.track('Product View', {
	"productName": "iPhone 13",
	"productCategory": "Mobiles",
	"price": "799",
	"currency": "USD",
 }, {
   	 "email": "john@gmail.com"
 })

Screen

The screen call lets you record whenever a user sees a screen, in your mobile app, along with any properties about the screen.

LemniskSdk.screen('<name>', {properties}, {otherIds})

The screen call has the following fields:

Parameter Type Data Type Description
name optional String The name of the Screen, for example Signup, Login, Home, Product, Cart.
properties optional Object A dictionary of properties for the screen.
otherIds optional Object A dictionary of other user identities you know about the user, like email or mobile or any other identifier

Example screen call:

LemniskSdk.screen('Home', {
	"key": "value",
}, null)

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Package Sidebar

Install

npm i lemnisk-react-native

Weekly Downloads

54

Version

0.1.14

License

none

Unpacked Size

211 kB

Total Files

34

Last publish

Collaborators

  • app-dev-lemnisk