🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@binance-chain/analytics-plugin-umami

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@binance-chain/analytics-plugin-umami

Umami analytics plugin for 'analytics' module

latest
npmnpm
Version
0.0.16
Version published
Maintainers
4
Created
Source

Umami Analytics

This library exports the Umami plugin for the analytics package & standalone methods for any project to use to make it easier to interact with Umami Analytics.

How to use

Below is an example of how to use the browser plugin.

Using npm:

import Analytics from '@binance-chain/analytics';
import umamiAnalytics from '@binance-chain/analytics-plugin-umami';

const analytics = Analytics({
  app: 'awesome-app',
  plugins: [
    umamiAnalytics({
      id: '2455d925-489d-4d28-be36-ad43c144e6af',
      reportUri: 'https://your.umami.reportUri',
    }),
  ],
});

/* Track a page view */
analytics.page();

/* Track a custom event */
analytics.track('playedVideo', {
  category: 'Videos',
  label: 'Fall Campaign',
  value: 42,
});

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

Using script tag:

<script src="../dist/umd/analytics-with-umami.min.js"></script>
<script type="text/javascript">
  var c = function (n, fns) {
    var _n = (window[n] = window[n] || {});
    for (var i = 0; i < fns.length; i++) {
      (function (_i) {
        var fn = fns[_i];
        _n[fn] ||
          (_n[fn] = function () {
            (_n[fn].q = _n[fn].q || []).push(arguments);
          });
      })(i);
    }
  };
  c('_analytics', ['init', 'track', 'page']);

  /* Initialize analytics */
  _analytics.init({
    id: '2455d925-489d-4d28-be36-ad43c144e6af',
    reportUri: 'http://localhost:3000',
  });

  _analytics.page();
</script>

FAQs

Package last updated on 13 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts