@envive-ai/analytics
v1.0.28
Published
EnviveAnalytics provides a high-level interface for tracking analytics events
Downloads
14,247
Keywords
Readme
Envive Analytics SDK
Requirements
The Envive team will provide some config options, primarily the API key.
Please install the following package on the frontend, client-side, and make the required function calls when events happen on the user side.
Installation
To install @envive-ai/analytics , install as follows:
npm install @envive-ai/analyticsor if using yarn
yarn add @envive-ai/analyticsUsage
NPM/Yarn Usage
import { EnviveAnalytics } from '@envive-ai/analytics'
interface EnviveAnalyticsOptions {
apiKey: string
}
options: EnviveAnalyticsOptions = {
apiKey: 'xxx',
}
const envive = new EnviveAnalytics(options)
envive.identifyUser("some-uuid")
envive.trackAddToCart({product:1, quantity: 1, price: 19.99});IdentifyUser
identifies the merchantUserId
identifyUser(merchantUserId: string, idType: string ): voidtrackCheckoutComplete
When a user completes a purchase, it is typically triggered on the thank you page.
Equivalent to Shopify checkout_completed event
trackCheckoutComplete({ eventProperties }) : void
// Required Properties
{
"total": 100
"currencyCode": "usd"
"products": [
{
"id": 123
"price": 100
"quantity": 1
}
]
}trackAddToCartClicked
When a user adds a product to their cart.
Equivalent to Shopify product_added_to_cart event
trackAddToCartClicked({ eventProperties }) : void
// Required properties
{
"id": 123
"price": 100
"currencyCode": "usd"
"quantity": 1
}