Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/strg-at/behave.tracking-client-plugins
STRG. beHave tracking-client plugins
https://github.com/strg-at/behave.tracking-client-plugins
behave javascript library strg
Last synced: about 1 month ago
JSON representation
STRG. beHave tracking-client plugins
- Host: GitHub
- URL: https://github.com/strg-at/behave.tracking-client-plugins
- Owner: strg-at
- License: mit
- Created: 2020-06-18T14:31:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-30T16:39:53.000Z (5 months ago)
- Last Synced: 2024-07-31T02:20:25.899Z (5 months ago)
- Topics: behave, javascript, library, strg
- Language: JavaScript
- Homepage:
- Size: 315 KB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# BeHave Tracking Plugins
This library contains standard BeHave tracking plugins, it is intended to use the plugins in the customer implementations and not standalone, they require [BeHave Tracking Client Library](https://bitbucket.strg.at/projects/BHV/repos/tracking-client-lib)## Getting Started
### Prerequisites
- [Node 10](https://nodejs.org/)
- [NPM 6.4.1](https://www.npmjs.com/)## plugin.scroll.js
The library is better known as breakpointmeter, it tracks the scroll depth in combination with `BeHave Tracking Client Library`.### How to use:
#### config
```javascript
const config = {
ARTICLE_SELECTOR: 'article',
}
```#### init
```javascript
import { createScrollTracking } from '@strg-behave/tracking-client-plugins'const scrollTracking = createScrollTracking()
scrollTracking.on('breakpoint', (event) => myTracker.track(event))
```#### register
```javascript
const articleElement = [] // Cast to array and pick first found
.concat(config.ARTICLE_SELECTOR)
.map(selector => document.querySelector(selector))
.filter(el => !!el)
.shift()
if (articleElement) {
scrollTracking.scrollDepth(articleElement, {
eventKey: 'breakpoint.content.percent.max',
})
}
```## plugin.referrer.js
This plugin tracks the `window.referrer` URL### How to use:
#### init
```javascript
import { createReferrerTracking } from '@strg-behave/tracking-client-plugins'const referrerTracking = createReferrerTracking()
referrerTracking.on('referrer', (event) => myTracker.track(event))
```## plugin.url.js
This plugin tracks the `window.location` URL### How to use:
#### init
```javascript
import { createUrlTracking } from '@strg-behave/tracking-client-plugins'const urlTracking = createUrlTracking()
urlTracking.on('url', (event) => myTracker.track(event))
```## Development
### Installation
```bash
npm install
```### Testing
```bash
npm run test
```### Coverage Report
Starts an interactive http server on port `8888`.
```bash
npm run coverage```
### ESLint
To check the code syntax integrity according to our ESLint specification run:
```bash
npm run lint
```To autofix code syntax integrity run:
```bash
npm run lint:fix
```## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the tags on this repository.
To increase a version and tag in GIT run:
```bash
npm version major|minor|patch
```## Authors
* **[Ralf Traunsteiner](mailto:[email protected])** - *plugin implementations*
* **[Nils Müller](mailto:[email protected])** - *library*