0.43.0 • Published 14 days ago

@lidofinance/analytics-matomo v0.43.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

@lidofinance/analytics-matomo

Matomo analytics. You can read about Matomo there.

Installation

yarn add @lidofinance/analytics-matomo

Cookie

Module does not send matomo event if cookie forbids.

If you need to send matomo event, you should set cookie with one of key:

  • 'LIDO_WIDGET__COOKIES_ALLOWED' soon will be deprecated
  • 'cookie-allowed' use it

and cookie value must be 'yes'.

document.cookie = 'cookie-allowed=yes'

Usage

Init Matomo

Variant 1

  1. Make sure that window contains __env__;
  2. Make sure that window.__env__ contains matomoHost something like window.__env__.matomoHost='https://matomo.somedomain.com/';
  3. Just import any from @lidofinance/analytics-matomo, for example:

import { trackEvent } from '@lidofinance/analytics-matomo'

If you can't provide matomoHost to window.__env__ see Variant 2.

Variant 2

  1. Import initMatomo from @lidofinance/analytics-matomo;
  2. Run initMatomo with parameter matomoHost: string like below:

import { initMatomo } from '@lidofinance/analytics-matomo'

initMatomo('https://matomo.somedomain.com/')

// some code

You can also pass any matomo configuration as a second argument

initMatomo('https://matomo.somedomain.com/', [
  // enable option
  ['option', true],
  ['option'],
  // disable option
  ['option', false],
  // enable and customize option
  ['option', 'value'],
])

Track event

import { callMatomo, trackEvent, wrapWithEventTrack } from '@lidofinance/analytics-matomo'

const matomoSomeEvent: MatomoEventType = [
  'Some_Stacking_Widget',
  'Push "Some" button',
  'some_widget_some_button_clicked',
]

// Variant 1
callMatomo('trackEvent', ...matomoSomeEvent)

// Variant 2
trackEvent(...matomoSomeEvent)

// Variant 3: through the decorator
const someHandler = wrapWithEventTrack(matomoSomeEvent, (arg1, arg2) => {
  // some function
})

someHandler('some_value1', 'some_value2')
0.43.0

14 days ago

0.42.0

2 months ago

0.41.0

2 months ago

0.40.0

3 months ago

0.39.1

5 months ago

0.39.0

7 months ago

0.38.0

8 months ago

0.37.1

8 months ago

0.37.0

8 months ago

0.36.0

8 months ago

0.35.0

9 months ago

0.34.0

9 months ago

0.33.0

10 months ago

0.32.0

10 months ago

0.31.0

10 months ago

0.30.0

10 months ago

0.29.0

10 months ago

0.28.0

11 months ago

0.21.0

1 year ago

0.27.0

11 months ago

0.26.0

11 months ago

0.25.0

12 months ago

0.24.0

12 months ago

0.23.0

12 months ago

0.22.0

12 months ago

0.20.0

1 year ago

0.19.0

1 year ago

0.17.0

1 year ago

0.18.0

1 year ago

0.14.0

1 year ago

0.15.0

1 year ago

0.16.0

1 year ago

0.13.0

1 year ago

0.12.0

1 year ago

0.11.0

1 year ago

0.10.0

1 year ago

0.9.0

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.0

2 years ago