0.0.16 • Published 3 years ago

@binance-chain/analytics v0.0.16

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Analytics

Install via yarn

yarn add analytics -S

How to use

/* example file src/analytics.js */
import Analytics from '@binance-chain/analytics';
import umamiPlugin from '@binance-chain/analytics-plugin-umami';

const analytics = Analytics({
  app: 'your-app-name',
  plugins: [
    // ... your analytics integrations
    umamiPlugin({
      id: '',
      reportUri: '',
    });
  ],
});

/* export the instance for usage in your app */
export default analytics;

For SPA

import Analytics, { onRouteChange } from '@binance-chain/analytics';

onRouteChange((newRoutePath) => {
  console.log('new route path', newRoutePath);
  // trigger page view
  analytics.page();
});