@letscooee/web-sdk
Advanced tools
Comparing version 0.0.20 to 0.0.21
# Change Log | ||
## 0.0.21 | ||
1. Introduce endpoint to set screen name. | ||
## 0.0.20 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@letscooee/web-sdk", | ||
"description": "AI driven Personalized Notifications for Better Customer Engagement", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"scripts": { | ||
@@ -6,0 +6,0 @@ "lint": "eslint 'src/**'", |
# Cooee Web SDK | ||
[![GitHub version](https://badge.fury.io/gh/letscooee%2Fcooee-android-sdk.svg)](https://badge.fury.io/gh/letscooee%2Fcooee-android-sdk) | ||
[![GitHub version](https://badge.fury.io/gh/letscooee%2Fcooee-web-sdk.svg)](https://badge.fury.io/gh/letscooee%2Fcooee-web-sdk) | ||
@@ -12,76 +12,4 @@ ## 👋 What is Cooee? | ||
## 🛠 Installation | ||
## Installation & Uses | ||
We at Cooee believe in the developer productivity and that's how our SDKs are written. The installation should take you | ||
no more than two hours. Period! | ||
### Use via CDN | ||
Following are the guidelines for installing Cooee SDK on to your Android mobile app. | ||
#### Step 1: Load SDK Asynchronously | ||
We recommend loading the SDK with the `async` flag so your page load time don't increase. To use it, place the following | ||
code before calling any other CooeeSDK functions. | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/@letscooee/web-sdk@latest/dist/sdk.min.js" async></script> | ||
<script> | ||
window.CooeeSDK = window.CooeeSDK || {events: [], profile: [], account: []}; | ||
CooeeSDK.account.push({"appID": "MY_COOEE_APP_ID"}); | ||
</script> | ||
``` | ||
Replace `MY_COOEE_APP_ID` with the app id as seen in your Cooee dashboard. | ||
#### Step 2: Track Custom Events | ||
Once you add the above snippet, the SDK will automatically start tracking some default event. Apart from these, you must | ||
track the given recommended events based on your industry. | ||
```javascript | ||
CooeeSDK.events.push(["Add To Cart", { | ||
item: { | ||
id: "15234", | ||
name: "Shoes" | ||
} | ||
}]); | ||
``` | ||
#### Step 3: Update User Profile | ||
Additional custom attributes/properties can also be shared. We encourage apps to share all properties for better machine | ||
learning modelling. | ||
```javascript | ||
CooeeSDK.profile.push({ | ||
name: "John Doe", | ||
email: "john@example.com", | ||
mobile: "9876543210", | ||
loggedIn: true, | ||
foo: "bar", | ||
subscriptions: { | ||
valid: true, | ||
pack: 1234 | ||
} | ||
}); | ||
``` | ||
#### Step 4: CTA Callbacks | ||
Cooee SDK supports callback on the click of in-app notifications actions by returning a map of key-value | ||
pairs i.e. objects in JavaScript. | ||
```javascript | ||
document.addEventListener('onCooeeCTA', function (event) { | ||
const payload = event.detail; | ||
if (!payload) return; | ||
if (payload.actionType === "VIEW_ITEM") { | ||
// Take the user to the given item's page. Item id will be in "payload.id" | ||
} else if (payload.actionType == "GO_TO_SCREEN") { | ||
// Take user to the given screen name | ||
} | ||
}, false); | ||
``` | ||
For detailed installation & uses, Refer [Web](https://docs.letscooee.com/developers/web/quickstart) documentation. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
17
329227
15