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

https://github.com/deryeger/page-views

A privacy-friendly counter for page views.
https://github.com/deryeger/page-views

analytics privacy views-count

Last synced: 5 months ago
JSON representation

A privacy-friendly counter for page views.

Awesome Lists containing this project

README

          

@yeger/page-views


Logo



Documentation



Deploy on Railway


A privacy-friendly counter for page views.



CI


NPM


Coverage


LGTM Grade


MIT


npm bundle size

# Features

- 🕵🏻‍♂️ **Privacy-friendly**: No user-tracking. Clients decide when to submit a page view.
- 🪶 **Lightweight & Simple**: Less than a kilobyte gzipped. Can be configured to automatically submit views, even after client-side navigation.
- 💻 **Self-hostable**: By default, a public instance of the backend is used. Alternatively, a self-hosted instance or a custom backend adhering to the scheme can be used.

## Installation

```bash
# yarn
$ yarn add @yeger/page-views

# npm
$ npm install @yeger/page-views
```

## Usage

```typescript
import PageViews from '@yeger/page-views'

// Manually submit a view of the current page
await PageViews.submitView()

// Automatically submit views
PageViews.autoSubmitViews()

// Get views of current page
await PageViews.getViews()
```

### Examples

React and Vue examples can be found [here](https://page-views.yeger.eu/examples/).

## Development

```bash
# install dependencies
$ yarn install

# build for production
$ yarn build

# build in watch mode
$ yarn dev

# lint project files
$ yarn lint

# serve docs
$ yarn docs:dev
```

## License

[MIT](./LICENSE) - Copyright © Jan Müller