clevertap-react
Version:
Wrapper to integrate Clevertap with ReactJS Applications
65 lines (44 loc) • 1.09 kB
Markdown
Wrapper to integrate Clevertap with ReactJS Applications.
Technically it should work with Any SPA like Angular, Vue, etc.
It should also support React Native. (untested)
*PR and Issues are welcomed*
- Installation `npm install --save clevertap-react`
- Initialize in your root
```js
import ClevertapReact from 'clevertap-react';
ClevertapReact.initialize("CLEVERTAP_ACCOUNT_ID");
```
First import library in your component
`import ClevertapReact from 'clevertap-react';`
- Push Event
```js
var payload = {
"Product name":"Casio Chronograph Watch",
"Category":"Mens Accessories",
"Price":59.99,
}
ClevertapReact.event("Product Viewed", payload)
// Payload is optional, if you dont want to pass it, you can just do
ClevertapReact.event("Product Viewed")
```
- Profile Push
```js
var payload = {
"Site": {
"Name": "Jack Montana", // User's name
"Age": 28
}
}
ClevertapReact.profile(payload)
```
- Logout
```js
ClevertapReact.logout()
```
- [x] Documentation
- [ ] Examples
- [ ] Support for Push Notifications.