https://github.com/m-radzikowski/siteclue-tracker
https://github.com/m-radzikowski/siteclue-tracker
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/m-radzikowski/siteclue-tracker
- Owner: m-radzikowski
- License: apache-2.0
- Created: 2021-06-01T10:18:58.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-19T02:44:50.000Z (over 2 years ago)
- Last Synced: 2024-09-14T13:37:34.597Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://siteclue.app
- Size: 375 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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`.