Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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*