clvision
Version:
Customer Lifetime Value tracking and analytics library for CLVision
54 lines (36 loc) • 1.29 kB
Markdown
CLVision tracking script for pageviews, signin and signups.
USAGE
npm install clvision
import { initialize } from 'clvision';
const clvision = initialize({
organizationId: 'your-org-id', // As provided by CLVision
baseURL: 'https://your-api-url' // Optional
});
// Track events
// Pageviews are tracked autonomously so long as the script is initialized in the root of your app as follows
import CLVision from "clvision";
const clvision = new CLVision({
organizationId: "your-org-id", // as provided by CLVision
baseURL: "https://clvision.app/api/tracking", // optional
});
// Send event on user sign up, run this on your auth signup callback
clvision.trackSignup('user@example.com');
// Send event on user sign in, run this on your auth signin callback
clvision.trackSignin('user@example.com');
// Example usage with different auth providers
// With Google
onGoogleSignIn((response) => {
const email = response.email;
const isNewUser = response.isNewUser;
if (isNewUser) {
clvision.trackSignup(email, 'google');
} else {
clvision.trackSignin(email, 'google');
}
});
// With Email/Password
onEmailSignup((email) => {
clvision.trackSignup(email, 'email');
});