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

https://github.com/m-radzikowski/siteclue-tracker


https://github.com/m-radzikowski/siteclue-tracker

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

          

# SiteClue Tracker script

## Embedding on website

### Automatic init

```html

```

### Manual init

```html

siteClue.init('123456');

```

### Bundling with other scripts

Install:

```bash
npm install siteclue-tracker
```

Initialize:

```ts
import {init} from 'siteclue-tracker';

init('123456');
```

## Sending events

Events are custom interactions measured independently from the page views.

Events have a three-level naming hierarchy:

- `category`
- `action`
- `label`

Values for all three can be any custom names.

The `label` is optional.

### Automatic event attachment

```html

Click me

```

`data-siteclue-event` field value is built from 4 parts:

```
trigger:category/action[/label]
```

`trigger` is a [JavaScript event](https://developer.mozilla.org/en-US/docs/Web/API/Element#events)
name to attach the event trigger to.
For example, the `click` value will trigger event to be sent on element mouse click.

The `label` part is optional.

For the `click` trigger, there is a shorter helper for setting the event:

```html

Click me

```

### Manual event sending

```js
siteClue.event('button', 'clicked', 'js');
```

Function parameters are, in order: `category`, `action`, and `label`.