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
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
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)
License
MIT licens