1.0.6 • Published 4 years ago
@heartbeatgmbh/klick v1.0.6
klick
An NPM Package for Heartbeat Klick
import Klick from "@heartbeatgmbh/klick"
Use the class
const klick = new Klick();
Tracking visited Objects:
klick.poi(123)
Integration
A few examples in how to use the Klick library for certain frameworks.
Nuxt.js
Create a new plugin for example plugins/klick.js
:
import Klick from '@heartbeatgmbh/klick'
export default (context, inject) => {
const klick = new Klick()
if (!process.client) {
// we need to set a default url for the ssr request which does not have an origin header
klick.fallbackUrl = context.req.headers.referer
? context.req.headers.referer
: context.req.headers.host
}
inject('klick', klick)
}
In order to work with ES6 Modules we need to add the library to the nuxt build transpiler in the nuxt.config.js
file:
build: {
transpile: [
'@heartbeatgmbh/klick'
]
}
Now you are able to use this.$klick
in the whole Nuxt.js application:
this.$klick.poi(1)
Internals
Best practive to publish new version of the library
- npm version patch -m 'fix class properties'
- git push
- npm publish