pangocdp-zmalog-sdk v0.3.7
Beta Pango Zalo Mini App Log SDK
To make it easy for you to integrate with PangoCDP ZMA Event Log.
Prerequisites
Variables that need to be provided by PangoCDP Team
- orgId
- cdpAppId
- publicKey
🛠️ Install Dependencies
npm
npm install pangocdp-zmalog-sdk
yarn
yarn add pangocdp-zmalog-sdk
🧐 Features
- Init SDK
- Follow OA
- Ingest log to PangoCDP
- Get User Info (name, avatar, phone number, location)
🧐 Init SDK Variables
Name | Type | Description | Sample |
---|---|---|---|
env | string | The environment of log (development, production) | development |
orgId | string | Organization ID | 8e23f11bae7e38478c3d0f99f467bb58 |
cdpAppId | string | PangoCDP App ID | d3dbe129c8259cea103660edcf4d6217-1730875326238 |
publicKey | string | Public key of PangoCDP App ID | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMII.... |
🧑🏻💻 Usage
Create new file instrument.ts
- Auto event generation: open-app
import * as PangoSDK from 'pangocdp-zmalog-sdk';
PangoSDK.init({
env: "development",
orgId: "8e23f11bae7e38478c3d0f99f467bb58",
cdpAppId: "d3dbe129c8259cea103660edcf4d6217-1730875326238",
publicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQE..."
})
Include the initialization file as the first import statement
import "./instrument";
import App from "./App";
import { createRoot } from "react-dom/client";
const container = document.getElementById(“app”);
const root = createRoot(container);
root.render(<App />);
Follow Offical Account
- Auto event generation when follow oa: follow-oa
import * as PangoSDK from 'pangocdp-zmalog-sdk';
const data = await PangoSDK.follow()
Ingest event log | Name| Type| Description | -------- | -------- | -------- | | unique | string | Set this event is unique in one session open app | | eventName| string | Name of the event | | eventData | object| Add more data to event |
import * as PangoSDK from 'pangocdp-zmalog-sdk';
PangoSDK.ingest({
unique: true,
eventName: "sdk-test",
eventData: { test: 'hihi' }
})
Get User Info
- Auto event generation when share phone: allow-phone
- Auto event generation when share location: share-location
- Auto event generation when not share: reject-zalo-permission
import * as PangoSDK from 'pangocdp-zmalog-sdk';
const data = await PangoSDK.getInfo(["scope.userLocation", 'scope.userPhonenumber'])
// {success: true, error: "", number: "0123456789", latitude: "10.709926", longitude: "106.709282"}
🙇 Author
vuongnd@bytetech.io
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago