0.0.12 • Published 3 days ago

@bikdotai/bik-event-tracker v0.0.12

Weekly downloads
-
License
ISC
Repository
-
Last release
3 days ago

Using Bik's Mobile Event Tracker you can track events in your mobile app and send them to Bik's servers.

Introduction

The integration is straightforward and can be done quickly. There are three basic steps in the integration

  • Initialize the tracker
  • Identify the customer
  • Log the events

Initialize the tracker

The init function takes in the shopify domain as a parameter. This is the domain of the shopify store that you are integrating with.

Please note this needs to be without https in the format bik.myshopify.com

If you want a testing domain, please contact Bik.

import { BikEventTracker } from '@bikdotai/bik-event-tracker'
const eventTracker = BikEventTracker.getInstance();
await eventTracker.init('bik.myshopify.com');

Identifying the user

You can identify the customer using the identify function. This function takes in a customer identification object which can take in

  • customerId: The shopify customer id
  • email: The email of the customer
  • phoneNumber: The phone number of the customer
const customerIdentification = {
    customerId: '123', // shopify's partner customer id
    email: 'test@gmail.com',
    phoneNumber: '1234567890'
};
await eventTracker.idenitfy(customerIdentification);

Logging events

Once you have identified the customer you can log these three events

  • Add to cart
  • Page viewed
  • Product viewed
const addToCartEvent: AddToCartAppEvent = {
    productId: '123',
    variantId: '123'
};
const pageViewedEvent: PageViewedAppEvent = {
    title: 'Test Page'
};
const productViewedEvent: ProductViewedAppEvent = {
    productId: '123',
    variantId: '123'
};
await eventTracker.track({
    eventName: 'addToCart',
    eventProperties: addToCartEvent
});
await eventTracker.track({
    eventName: 'pageViewed',
    eventProperties: pageViewedEvent
});
await eventTracker.track({
    eventName: 'productViewed',
    eventProperties: productViewedEvent
});

Enabling debugging

We can enable debugging by passing an extra parameter to the app. This will enable logging to help you identify issues

import { BikEventTracker } from '@bikdotai/bik-event-tracker'
const eventTracker = BikEventTracker.getInstance();
await eventTracker.init('bik.myshopify.com', true);
0.0.11-beta.1

3 days ago

0.0.12

3 months ago

0.0.10

3 months ago

0.0.11

3 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago