EnviveAnalytics provides a high-level interface for tracking analytics events
npm install @envive-ai/analyticsThe 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.
To install @envive-ai/analytics , install as follows:
``sh`
npm install @envive-ai/analytics
or if using yarn
`shell`
yarn add @envive-ai/analytics
NPM/Yarn Usage
`tsx
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});
`
identifies the merchantUserId
`tsx`
identifyUser(merchantUserId: string, idType: string ): void
When a user completes a purchase, it is typically triggered on the thank you page.
Equivalent to Shopify checkout\_completed event
`tsx
trackCheckoutComplete({ eventProperties }) : void
// Required Properties
{
"total": 100
"currencyCode": "usd"
"products": [
{
"id": 123
"price": 100
"quantity": 1
}
]
}
`
When a user adds a product to their cart.
Equivalent to Shopify product\_added\_to\_cart event
`tsx``
trackAddToCartClicked({ eventProperties }) : void
// Required properties
{
"id": 123
"price": 100
"currencyCode": "usd"
"quantity": 1
}