@bilyai/js
v1.0.32
Published
> TODO: description
Downloads
74
Readme
Official Bily SDK for Browser
Don't already have an account and store added ? Head over to Bily, then return to this page.
☕ Install package
npm install @bilyai/js
yarn add @bilyai/js
🚦 Configurations
Configuration should happen as early as possible in your application's lifecycle.
import { init } from '@bilyai/js';
init('https://b.magnetor.net');
Once implemented, Bily's JavaScript SDK will automatically track all pageviews. You can now begin tracking all other events as well.
🚀 Start tracking events
import { track } from '@bilyai/js';
track('Product Viewed', {
client: {
firstname: 'John',
lastname: 'Doe',
// ... other attributes here
},
products: [
{
id: '123',
name: 'Product 1',
price: 100,
quantity: 1,
currency: 'USD',
sku: '123',
category: 'Category 1',
brand: 'Brand 1',
},
],
// ...other attributes here
});
import { track } from '@bilyai/js';
track('Product Added', {
client: {
firstname: 'John',
lastname: 'Doe',
// ... other attributes here
},
products: [
{
id: '123',
name: 'Product 1',
price: 100,
quantity: 1,
currency: 'USD',
sku: '123',
category: 'Category 1',
brand: 'Brand 1',
},
],
// ...other attributes here
});
import { track } from '@bilyai/js';
track('Checkout Started', {
client: {
firstname: 'John',
lastname: 'Doe',
email: '[email protected]',
// ... other attributes here
},
products: [
{
id: '123',
name: 'Product 1',
price: 100,
quantity: 1,
currency: 'USD',
sku: '123',
category: 'Category 1',
brand: 'Brand 1',
},
],
// ...other attributes here
});
import { track } from '@bilyai/js';
track('Order Completed', {
client: {
firstname: 'John',
lastname: 'Doe',
email: '[email protected]',
phone: '1234567890',
gender: 'male',
dateOfBirth: '1990-01-01',
address: {
city: 'New York',
state: 'NY',
country: 'US',
zip: '10002',
},
// ... other attributes here
},
order: {
id: '123',
currency: 'USD',
total: 100,
products: [
{
id: '123',
name: 'Product 1',
price: 100,
quantity: 1,
currency: 'USD',
sku: '123',
category: 'Category 1',
brand: 'Brand 1',
},
],
},
// ...other attributes here
});
If you get stuck, shoot us an email or use the Intercom widget on the bottom right of any page.
We're excited you're here! :blue-heart: