react-native-contlo
v1.3.0-beta.2
Published
SDK for capturing shop events for your app, built using React Native.
Downloads
15
Readme
React Native Contlo
SDK Installation
Install Contlo's React Native plugin using the npm package manager.
$ cd path_to_your_project
Add the contlo plugin from npm
$ npm install react-native-contlo
Please note: if you're using Expo for development, be sure to be using the "bare workflow".
ContloAPI Usage
import { ContloAPI } from 'react-native-contlo'
// Init ContloAPI with your Stores public API key
// call this function in your index.js file
ContloAPI.init({apiKey: '<YOUR_API_KEY>'})
// Set email, phone one of the fields is mandatory for sending a request
ContloAPI.set.userEmail('[email protected]')
ContloAPI.set.userPhone('+912223334444')
// Set methods (optional)
ContloAPI.set.userFirstName('John')
ContloAPI.set.userLastName('Doe')
ContloAPI.set.userCity('bangalore')
ContloAPI.set.userProvince('')
ContloAPI.set.userZip('560010')
ContloAPI.set.userCountry('india')
// Get methods
ContloAPI.get.userEmail()
ContloAPI.get.userPhone()
ContloAPI.get.userFirstName()
ContloAPI.get.userLastName()
ContloAPI.get.userCity()
ContloAPI.get.userProvince()
ContloAPI.get.userZip()
ContloAPI.get.userCountry()
// Events Template
// Template for sending any custom/user Events to contlo (events)
// {
// "event": "<event_key>",
// "email": "[email protected]",
// "phone_number": "+912223334444",
// "properties": {
// "key1": "<key1>",
// "key2": <key2>,
// }
// }
// Template Profile Identification (create/set customer profile)
// {
// "custom_properties": {
// "property1": "<value1>",
// "property2": "<value2>",
// },
// "first_name": "John",
// "last_name": "Doe",
// "email": "[email protected]",
// "phone_number": "+12223334444",
// "country": "india",
// "zip": "560010",
// "city": "bangalore"
// }
// If you don't want to send customProperties just pass in an empty object {}
// Send methods (async methods) - return type promise
ContloAPI.send.event({event: event, properties: properties})
ContloAPI.send.profile({customProperties: customProperties})