Skip to content

Hexlet/analytics-plugin-dittofeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analytics Plugin for Dittofeed

Overview

Analytics plugin for analytics, powered by @dittofeed/sdk-web. Supports identify, track, and page methods.

Installation

npm i @hexlet/analytics-plugin-dittofeed

Usage

import Analytics from 'analytics';
import dittofeed from '@hexlet/analytics-plugin-dittofeed';

const analytics = Analytics({
  app: 'test-app',
  plugins: [
    dittofeed({
      sdkInit: {
        writeKey: 'Basic abcdefg...', // Public write key from Dittofeed dashboard
        // apiHost: 'https://app.dittofeed.com' // Can be overridden for self-host
      },
      enable: process.env.NODE_ENV === 'production', // Enable only in production
    }),
  ],
});

// page
analytics.page(); // page event (defaults with document.title)

// identify
analytics.identify('user_123', {
  email: '[email protected]',
  firstName: 'John',
});

// track
analytics.track('Made Purchase', {
  itemId: 'abc123',
  price: 49.9,
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published