@erst-vg/piwik-event-wrapper
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

piwik-event-wrapper

Thin wrapper used by 3rd party applications to collect and send end-user behavior events to Virksomhedsguiden main platform.

Installation

$ npm install @erst-vg/piwik-event-wrapper

Piwik service

Using the Piwik service, it is possible to invoke tracking functions from any depth of the component tree. The only requirement is Piwik service must be initialized in the entry point component. It supports both Options API and Composition API.

Init using Options API

Initialize Piwik service from the entry point component

piwikService.init(this.$emit);

Init using Composition API

Initialize Piwik service using Vue 3 script setup in the entry point component

// Specify only the applicable DataEvents
const emit = defineEmits([DataEvents.START_EVENT]);
piwikService.init(emit);

Usage

Using the initialized Piwik service, invoke one of the following functions whenever tracking is needed:

  • emitPageViewEvent
  • emitDownloadEvent
  • emitCTAClickEvent
  • emitStartEvent
  • emitSlutEvent
// Usage from another component
piwikService.emitStartEvent();

Legacy

It is still possible to use the legacy approach, but is no longer recommended due to techinal limitations.

Usage

Invoke one of the following functions provided by this package whenever tracking is needed. Every function should be called with the instance of the Vue applikation (this) as the first argument.

  • emitPageViewEvent
  • emitDownloadEvent
  • emitCTAClickEvent
  • emitStartEvent
  • emitSlutEvent
  • emitNaesteEvent (deprecated)
  • emitForrigeEvent (deprecated)
  • emitFritekstEvent (deprecated)
emitPageViewEvent(this) // "this" being the Vue instance of the root component

License

MIT licens

Readme

Keywords

Package Sidebar

Install

npm i @erst-vg/piwik-event-wrapper

Weekly Downloads

0

Version

2.0.3

License

MIT

Unpacked Size

13.8 kB

Total Files

13

Last publish

Collaborators

  • erst-vg