# graphable

> Analytics code for logging and visualizing user sessions in your app.

Latest version **1.0.0** (published 2020-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphable
pnpm add graphable
yarn add graphable
bun add graphable
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-11-04 |
| First published | 2020-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Autoplay Technologies |
| Maintainers | autoplay-technologies |
| Keywords | analytics, screen, tracking, logging, events, ui, ux |

## Links

- npm: https://www.npmjs.com/package/graphable
- Repository: https://github.com/autoplay-technologies/graphable
- Homepage: https://github.com/autoplay-technologies/graphable#readme
- Issues: https://github.com/autoplay-technologies/graphable/issues
- npm.io page: https://npm.io/package/graphable

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-11-04

## README

# Graphable Node.js Library

The Graphable Node library provides convenient access to the Graphable API from
client applications written in JavaScript.

## Documentation

See the [`graphable` API docs](https://docs.graphable.io/api?lang=node) for Node.js.

## Installation

Install the package with:

```sh
npm install graphable
# or
yarn add graphable
```

## Usage

Graphable functions require a config object containing information about the client app and current version.
Config objects are available in the [Graphable Dashboard](https://dashboard.graphable.io/).

<!-- prettier-ignore -->
```js
const config = {
    api_key: 'test_key-...',
    app_id: 'app-...',
    project_id: 'proj-...',
};
const graphable = require('graphable')(config);

graphable.logScreenChange({
  screen_id: 'home',
})
  .then(event => console.log(event.created_at))
  .catch(error => console.error(error));
```

Or using ES modules and `async`/`await`:

```js
import Graphable from 'graphable';
const config = {
    api_key: 'test_key-...',
    app_id: 'app-...',
    project_id: 'proj-...',
};
const graphable = new Graphable(config);

(async () => {
  try {
      const event = await graphable.logScreenChange({
        screen_id: 'home',
      });
    
      console.log(event.created_at);
  }
  catch (error) {
      console.error(error);
  }
})();
```

### Usage with TypeScript

Graphable maintains types for the latest [API version][api-versions].

Import Graphable as a default import (not `* as Graphable`, unlike the DefinitelyTyped version)
and instantiate it as `new Graphable()`.

```ts
import Graphable from 'graphable';
const config = {
    api_key: 'test_key-...',
    app_id: 'app-...',
    project_id: 'proj-...'
};
const graphable = new Graphable(config);

const createScreenChangeEvent = async () => {
  const params: Graphable.ScreenChangeEventCreateParams = {
    screen_id: 'home',
  };

  const event: Graphable.ScreenChangeEvent = await graphable.logScreenChange(params);

  console.log(event.created_at);
};
createScreenChangeEvent();
```


[api-versions]: https://docs.graphable.io/api/versioning

---
_Source: https://npm.io/package/graphable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
