4.2.8 • Published 8 months ago

@monkvision/posthog v4.2.8

Weekly downloads
-
License
BSD-3-Clause-Clea...
Repository
github
Last release
8 months ago

@monkvision/posthog

This package exports a analytics adapter that can be used to configure the analytics of MonkJs projects using the @monkvision/analytics project. The adapter exported by this package uses posthog, a analytics platform used by MonkJs to track event in its project. If you want to know more about analytics adapters and the features they offer, please refer to the official documentation of the @monkvision/analytics package.

Installing

To install the package, you can run the following command :

yarn add @monkvision/analytics @monkvision/posthog

If you are using TypeScript, this package comes with its type definitions integrated, so you don't need to install anything else!

Basic Usage

Set Up

In order to configure the posthog inside your application, you first need to instantiate the Posthog Adapter and then wrap your root component in the AnalyticsProvider and passing it the adapter as a prop :

import { PosthogAnalyticsAdapter } from '@monkvision/posthog';
import { AnalyticsProvider } from '@monkvision/analytics';

const adapter = new PosthogAnalyticsAdapter({
  token: 'phc_iNzK7jyK2bLtRi9vNWnzQqy74rIPlXPdgGs0qgJrSfL',
  api_host: 'https://eu.posthog.com',
  environnement: 'development',
  projectName: 'test',
  release: '1.0.0',
});

const container = document.getElementById('root');
render((
  <AnalyticsProvider adapter={adapter}>
    <App/>
  </AnalyticsProvider>
), container);

API

PosthogAnalyticsAdapter

Description

A Posthog Adapter logs everything in the posthog platform. This can be used in your app when you want to implement posthog for advanced analytics Features such tracking events, and behavior of the user.

Config Options

OptionDescriptionRequiredDefault Value
tokenToken key for posthog.com project with which your application will connect for sending all the information.NULL
environmentThe environment of your application (e.g. "production").local
api_hostThe URL of the Posthog application.https://eu.pothog.com
releaseRelease version of application1.0.0
projectNameThe name of the project or client.monkjs

Examples of Usage

import { PosthogAnalyticsAdapter } from '@monkvision/posthog';
import { AnalyticsProvider } from '@monkvision/analytics';

const adapter = new PosthogAnalyticsAdapter({
  token: '',
  api_host: 'https://eu.posthog.com',
  environnement: '',
  projectName: '',
  release: '',
});

const container = document.getElementById('root');
render((
  <AnalyticsProvider adapter={adapter}>
    <App/>
  </AnalyticsProvider>
), container);
4.2.7

8 months ago

4.2.8

8 months ago

4.2.6

8 months ago

4.2.5

8 months ago

4.2.3

8 months ago

4.2.2

8 months ago

4.2.4

8 months ago

4.1.0

8 months ago

4.2.1

8 months ago

4.2.0

8 months ago

4.0.21

9 months ago

4.0.20

9 months ago

4.0.24

9 months ago

4.0.19

9 months ago

4.0.18

9 months ago

4.0.17

9 months ago

4.0.16

10 months ago

4.0.15

10 months ago

4.0.12

10 months ago

4.0.14

10 months ago

4.0.13

10 months ago

4.0.10

10 months ago

4.0.11

10 months ago

4.0.9

10 months ago

4.0.8

10 months ago

4.0.7

11 months ago

4.0.6

11 months ago

4.0.5

11 months ago

4.0.4

11 months ago

4.0.3

11 months ago

4.0.2

11 months ago

4.0.1

11 months ago

4.0.0

11 months ago