@hexlet/analytics-plugin-n8n

1.0.4 • Public • Published

analytics-n8n

This library exports the n8n plugin for the analytics package.

Installation

npm install analytics @hexlet/analytics-plugin-n8n

How to use

import Analytics from 'analytics';
import N8nPlugin from '@hexlet/analytics-plugin-n8n';

const n8nConfig = {
  event_one: 'https://workflows.hexlet.io/webhook/pathOne', // this must be n8n trigger url
  event_two: 'https://workflows.hexlet.io/webhook/pathTwo',
};

const analytics = Analytics({
  app: 'my-app',
  plugins: [
    N8nPlugin({
      workflows: n8nConfig,
    }),
  ],
});

// track an event
analytics.track('signed_up', { email: 'user@example.com' });

In browser

<script src="https://unpkg.com/analytics/dist/analytics.min.js"></script>
<script src="https://unpkg.com/@hexlet/analytics-plugin-n8n/dist/main.js"></script>
<script>
  var Analytics = _analytics.init({
    app: 'my-app',
    plugins: [
      N8nPlugin({
        workflows: n8nConfig,
      }),
    ],
  });

  Analytics.track('signed_up', { email: 'user@example.com' }); // track an event
</script>

Readme

Keywords

Package Sidebar

Install

npm i @hexlet/analytics-plugin-n8n

Weekly Downloads

291

Version

1.0.4

License

ISC

Unpacked Size

34.5 kB

Total Files

14

Last publish

Collaborators

  • dzencot
  • grozwalker
  • mshkv
  • mokevnin
  • corsicanec82