Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
indent_style = spaces
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
13 changes: 13 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parser": "@typescript-eslint/parser",
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".js", ".ts"]
}
},
"plugins": ["@typescript-eslint"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript"
]
}
22 changes: 22 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: check

on:
pull_request:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
name: Check
steps:
- name: Checkout
uses: actions/checkout@v2.1.0

- name: Install, test and build
uses: actions/setup-node@v1.1.0
with:
node-version: 12.14.1
- run: npm install
- run: npm run lint
- run: npm run build
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
name: Release
steps:
- name: Checkout
uses: actions/checkout@v2.1.0

- name: Setup
uses: actions/setup-node@v1.1.0
with:
node-version: 12.14.1
- run: npm install

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
node_modules
6 changes: 6 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "eslint --fix && pretty-quick --staged"
}
}
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
123 changes: 81 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,107 @@
# track-js-data-api
NodeJS implementation of the Track JS Data Api
<p align="center">
<a href="https://trackjs.com/" target="_blank" align="center">
<img src="https://trackjs.com/assets/external/github_readme.svg" width="280">
</a>
<br />
</p>

# Prerequisites
You'll need to get a Track JS API Access API key and a Track JS API Access Customer ID from
# TrackJS Data API for NodeJS

NodeJS implementation of the Track JS Data API.

## Reference

- [TrackJS Data API Documentation](https://docs.trackjs.com/data-api/)

## Prerequisites

You'll need to get a Track JS API key and a Track JS API Customer ID from
https://my.trackjs.com/Account/Organization.

#Installation and Initialization
## Usage

````
Install the dependency:

```
npm install track-js-data-api
````
```

Then in your Node application
Then in your Node application:

````
const trackjs = require('track-js-data-api');
```js
import { Client } from 'track-js-data-api';

track.init({ apiKey: '<insert your apikey here>', customerId: '<insert your customerId here>' });
````
const trackJs = new Client(
'<insert your apiKey here>',
'<insert your customerId here>'
);
```

After that you are good to go!

#Available Exports
## Available exports

## errors
### trackJs.getErrors(params)

`trackjs.errors(configObj, cb)`
http://docs.trackjs.com/data-api/errors
API reference: http://docs.trackjs.com/data-api/errors

## errorsByDay
| Parameter | type | Required | Description |
| -------------- | --------------- | -------- | --------------------------------------------------------------------------------------------- |
| `application` | String | no | Filter the results to only the Application key provided. |
| `endDate` | ISO 8601 String | no | Filter the results to only return errors before this date. Time precision is within 1 second. |
| `startDate` | ISO 8601 String | no | Filter the results to only return errors after this date. Time precision is within 1 second. |
| `page` | Number | no | The page of data you want returned. By default, the first page of data is returned. |
| `size` | Number | no | The size of the page of data you want returned. |
| `query` | Number | no | Filter the results to errors that match the supplied query term. |
| `includeStack` | Boolean | no | Whether to return a stackTrace with the Error response. |

`trackjs.errorsByDay(configObj, cb)`
http://docs.trackjs.com/data-api/errors-by-day
### trackJs.getErrorsByDay(params)

## errorsByMessage
API reference: http://docs.trackjs.com/data-api/errors-by-day

`trackjs.errorsByMessage(configObj, cb)`
http://docs.trackjs.com/data-api/errors-by-message
| Parameter | type | Required | Description |
| ------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `application` | String | no | Filter the results to only the Application key provided. |
| `endDate` | ISO 8601 String | no | Filter the results to only return errors before this date. Time precision is within 1 second. |
| `startDate` | ISO 8601 String | no | Filter the results to only return errors after this date. Time precision is within 1 second. |
| `page` | Number | no | The page of data you want returned. By default, the first page of data is returned. |
| `size` | Number | no | The size of the page of data you want returned. |
| `sort` | String | no | By default the endpoint returns results sorted by date in descending order. You may adjust the sort field and sort direction. Supported fields are `date`, `count` and `usercount`. Sort directions are specified by appending `| asc` or `| desc`. Default value is `date | desc` if not specified. |

## errorsByUrl
### trackJs.getErrorsByMessage(params)

`trackjs.errorsByUrl(configObj, cb)`
http://docs.trackjs.com/data-api/errors-by-url
API reference: http://docs.trackjs.com/data-api/errors-by-message

## pageViewsByDay
| Parameter | type | Required | Description |
| ------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `application` | String | no | Filter the results to only the Application key provided. |
| `endDate` | ISO 8601 String | no | Filter the results to only return errors before this date. Time precision is within 1 second. |
| `startDate` | ISO 8601 String | no | Filter the results to only return errors after this date. Time precision is within 1 second. |
| `page` | Number | no | The page of data you want returned. By default, the first page of data is returned. |
| `size` | Number | no | The size of the page of data you want returned. |
| `sort` | String | no | By default the endpoint returns results sorted by date in descending order. You may adjust the sort field and sort direction. Supported fields are `date`, `count` and `usercount`. Sort directions are specified by appending `| asc` or `| desc`. Default value is `date | desc` if not specified. |

`trackjs.pageViewsByDay(configObj, cb)`
http://docs.trackjs.com/data-api/pageviews-by-day
### trackJs.getErrorsByUrl(params)

# configObj
API reference: http://docs.trackjs.com/data-api/errors-by-url

All of the methods, take a config object:
| Parameter | type | Required | Description |
| ------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `application` | String | no | Filter the results to only the Application key provided. |
| `endDate` | ISO 8601 String | no | Filter the results to only return errors before this date. Time precision is within 1 second. |
| `startDate` | ISO 8601 String | no | Filter the results to only return errors after this date. Time precision is within 1 second. |
| `page` | Number | no | The page of data you want returned. By default, the first page of data is returned. |
| `size` | Number | no | The size of the page of data you want returned. |
| `sort` | String | no | By default the endpoint returns results sorted by date in descending order. You may adjust the sort field and sort direction. Supported fields are `date`, `count` and `usercount`. Sort directions are specified by appending `| asc` or `| desc`. Default value is `date | desc` if not specified. |

```json
{
startDate: <YYYY-MM-DDTHH:MM:SS<timezone>>,
endDate: <YYYY-MM-DDTHH:MM:SS<timezone>>,
page: <page number to return>,
size: <number of items on a page>,
application: <application of which to filter results by>,
sort: <(date|count|usercount)>|<asc|desc>
}
```
### trackJs.getPageViewsByDay(params)

# Dependencies
API reference: http://docs.trackjs.com/data-api/pageviews-by-day

* Request module
| Parameter | type | Required | Description |
| ------------- | --------------- | -------- | --------------------------------------------------------------------------------------------- |
| `application` | String | no | Filter the results to only the Application key provided. |
| `endDate` | ISO 8601 String | no | Filter the results to only return errors before this date. Time precision is within 1 second. |
| `startDate` | ISO 8601 String | no | Filter the results to only return errors after this date. Time precision is within 1 second. |
| `page` | Number | no | The page of data you want returned. By default, the first page of data is returned. |
| `size` | Number | no | The size of the page of data you want returned. |
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
84 changes: 0 additions & 84 deletions index.js

This file was deleted.

Loading