Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lidofinance/analytics-matomo

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lidofinance/analytics-matomo

Matomo analytics

  • 0.37.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
414
increased by38%
Maintainers
2
Weekly downloads
 
Created
Source

@lidofinance/analytics-matomo

Matomo analytics. You can read about Matomo there.

Installation

yarn add @lidofinance/analytics-matomo

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')

FAQs

Package last updated on 22 Sep 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc