# @jarek-arcx/testlibrary

> `ArcxAnalyticsSdk` is a wrapper for [ARCx Analytics API](https://docs.arcx.money/#tag--analytics). It aims at increasing the usability and simplicity of our API.

Latest version **0.0.7** (published 2022-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jarek-arcx/testlibrary
pnpm add @jarek-arcx/testlibrary
yarn add @jarek-arcx/testlibrary
bun add @jarek-arcx/testlibrary
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2022-09-09 |
| First published | 2022-09-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 196.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yaraslau Stsetskevich |
| Maintainers | jarek-arcx |

## Links

- npm: https://www.npmjs.com/package/@jarek-arcx/testlibrary
- npm.io page: https://npm.io/package/@jarek-arcx/testlibrary

## Dependencies (1)

- [@restless/sanitizers](https://npm.io/package/@restless/sanitizers.md) ^0.2.5

## Recent versions

- 0.0.7 (latest) — 2022-09-09
- 0.0.6 — 2022-09-09
- 0.0.5 — 2022-09-09
- 0.0.4 — 2022-09-07
- 0.0.3 — 2022-09-06
- 0.0.2 — 2022-09-06
- 0.0.1 — 2022-09-06

## README

# ArcxAnalyticsSdk

`ArcxAnalyticsSdk` is a wrapper for [ARCx Analytics API](https://docs.arcx.money/#tag--analytics). It aims at increasing the usability and simplicity of our API.

```js
const arcxAnalyticsSdk = await ArcxAnalyticsSdk.init(YOUR_API_KEY)
await arcxAnalyticsSdk.event('EXAMPLE_EVENT', {
  attribute: 'random',
  anotherAttribute: 'value',
})
```

# Installation

```cli
npm install @arcxmoney/analytics
yarn add @arcxmoney/analytics
```

# Api

- [`init`](#init)
- [`event`](#event)
- [`page`](#page)
- [`transaction`](#transaction)
- [`connectWallet`](#connectWallet)

### `init`

This function is used to initialize the `ArcxAnalyticsSdk` instance. An `api key` is is required to invoke it, simply [contact us](https://discord.gg/hfrbGzPyK8) and we'll be happy to provide you one and start our collaboration.

`init` takes two arguments:

1. Api key (generated by the ARCx team) - required
2. Sdk configuration (see example below for detailed information) - optional

Example:

```javascript
import { ArcxAnalyticsSdk } from '@arcxmoney/analytics'

...
await arcxAnalyticsSdk = await ArcxAnalyticsSdk.init(
  YOUR_API_KEY,
  {
    trackPages: true, // default - automatically trigger PAGE event if the url changes after click
    cacheIdentity: true, // default - caches identity of users in their browser's local storage
  }
)
```

### `event`

Save a custom `event` in order to be analysed by the ARCx Team.

Example:

```javascript
import { ArcxAnalyticsSdk } from '@arcxmoney/analytics'

...
await arcxAnalyticsSdk = await ArcxAnalyticsSdk.init(YOUR_API_KEY)
await arcxAnalyticsSdk.event(
  'EXAMPLE_EVENT',
  {
    attribute: 'random',
    anotherAttribute: 'value',
  },
)
```

### `page`

Save a standardized `event` to track changes on a given page.

Example:

```javascript
import { ArcxAnalyticsSdk } from '@arcxmoney/analytics'

...
await arcxAnalyticsSdk = await ArcxAnalyticsSdk.init(YOUR_API_KEY)
await arcxAnalyticsSdk.page(
  'EXAMPLE_EVENT',
  {
    url: 'https://target.url',
  },
)
```

### `transaction`

Save a standardized `event` to track executed Web3 transactions.

Example:

```javascript
import { ArcxAnalyticsSdk } from '@arcxmoney/analytics'

...
await arcxAnalyticsSdk = await ArcxAnalyticsSdk.init(YOUR_API_KEY)

await analyticsSdk.transaction(
  transactionType, // required(string) - type of trasaction e.g. 'SWAP', 'STAKE'...
  transactionHash, // optional(string) - hash of the transaction
  attributes, // optional(object) - additional information about the transaction
)
```

### `connectWallet`

Save a standardized `event` to track connections to wallets.

Example:

```javascript
import { ArcxAnalyticsSdk } from '@arcxmoney/analytics'

...
await arcxAnalyticsSdk = await ArcxAnalyticsSdk.init(YOUR_API_KEY)

await analyticsSdk.connectWallet({
  account: '0x1234',
  chain: '1',
})
```

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