npm package: @plasma-platform/service-statistics
Description: TM statistics service api
Author: Kyrylo Voronoi
Latest version: 2.2.0

![version](https://badgen.net/npm/v/@plasma-platform/service-statistics)
![nextVersion](https://badgen.net/npm/v/@plasma-platform/service-statistics/next)
![downloads](https://badgen.net/npm/dt/@plasma-platform/service-statistics)
![license](https://badgen.net/npm/license/@plasma-platform/service-statistics)
![dependency](https://badgen.net/npm/dependents/@plasma-platform/service-statistics)  

* * *

[Full documentation](https://templatemonster.gitlab.io/PlasmaPlatform/Frontend/plasma-platform/?path=/story/plasma-platform-sdk--service-statistics)  
install:  
`npm i @plasma-platform/service-statistics -S`  

# Short documentation

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

-   [StatisticsService](#statisticsservice)
    -   [Parameters](#parameters)
-   [trackTemplateView](#tracktemplateview)
    -   [Parameters](#parameters-1)
    -   [Examples](#examples)
-   [getReviewStatistics](#getreviewstatistics)
    -   [Parameters](#parameters-2)
    -   [Examples](#examples-1)
-   [getOneStatistics](#getonestatistics)
    -   [Parameters](#parameters-3)
    -   [Examples](#examples-2)
-   [getSaleStatistics](#getsalestatistics)
    -   [Parameters](#parameters-4)
    -   [Examples](#examples-3)
-   [getViewStatistics](#getviewstatistics)
    -   [Parameters](#parameters-5)
    -   [Examples](#examples-4)
-   [getTrafficStatisticsByChannel](#gettrafficstatisticsbychannel)
    -   [Parameters](#parameters-6)
    -   [Examples](#examples-5)
-   [getStatisticsChannelTraffic](#getstatisticschanneltraffic)
    -   [Parameters](#parameters-7)
    -   [Examples](#examples-6)
-   [getTrafficStatisticsBySource](#gettrafficstatisticsbysource)
    -   [Parameters](#parameters-8)
    -   [Examples](#examples-7)
-   [getStatisticsTrafficChannelsList](#getstatisticstrafficchannelslist)
    -   [Examples](#examples-8)
-   [getTotalSaleStatistics](#gettotalsalestatistics)
    -   [Parameters](#parameters-9)
    -   [Examples](#examples-9)
-   [getTotalProductStatistics](#gettotalproductstatistics)
    -   [Parameters](#parameters-10)
    -   [Examples](#examples-10)
-   [getStatisticsTransactionsInfo](#getstatisticstransactionsinfo)
    -   [Parameters](#parameters-11)
    -   [Examples](#examples-11)
-   [getMinYearStatistics](#getminyearstatistics)
    -   [Parameters](#parameters-12)
    -   [Examples](#examples-12)
-   [getStatisticsProductDiscounts](#getstatisticsproductdiscounts)
    -   [Parameters](#parameters-13)
    -   [Examples](#examples-13)
-   [getStatisticsProductBoosts](#getstatisticsproductboosts)
    -   [Parameters](#parameters-14)
    -   [Examples](#examples-14)

## StatisticsService

-   **See: <http://service-services.dev:8116/doc/>**

### Parameters

-   `url` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** service url
-   `token` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null)** user access token if available (optional, default `null`)

## trackTemplateView

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     templateId: Template id. (to track statistic on template),
     userId: Author User Id. (to track statistic on author),
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v1/');
  const request = await service.trackTemplateView(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getReviewStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     entity_id: entity id - id author or template,
     access_token: users token,
     type: type review statistics - author or template,
     date_from: date start for statistics,
     date_to: date end for statistics,
     group: group review for statistics, default day,
     type_id: type id for filter statistics data,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getReviewStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getOneStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     access_token: user's access token,
     entity_id: entity id - id author or template,
     type: type one statistics - author or template,
     date_from: date start for statistics,
     date_to: date end for statistics,
     type_id: type id for filter statistics data,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getOneStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getSaleStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     entity_id: entity id - id author or template,
     access_token: users token,
     type: type sale statistics - author or template,
     date_from: date start for statistics,
     date_to: date end for statistics,
     group: group sale for statistics, default day,
     country: country for filter sale statistics,
     type_id: type id for filter statistics data,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getSaleStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getViewStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     entity_id: entity id - id author or template,
     access_token: users token,
     type: type view statistics - author or template,
     date_from: date start for statistics,
     date_to: date end for statistics,
     group: group view for statistics, default day,
     country: country for filter view statistics,
     type_id: id of type products for filter view statistics,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getViewStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getTrafficStatisticsByChannel

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     entity_id: entity id - id author or template,
     access_token: users token,
     type: type traffic statistics - author or template,
     date_from: date start for statistics,
     date_to: date end for statistics,
     group: Statistic grouping, default day,
     country: Get statistic filtered by country iso2code
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getSaleStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getStatisticsChannelTraffic

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     access_token: users token,
     date_from: date start for statistics,
     date_to: date end for statistics,
     group: Statistic grouping, default day,
     channel: Get statistic filtered by channel
     type_id: Get statistic filtered by type_id
     product_id: Get statistic filtered by product_id
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getStatisticsChannelTraffic(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getTrafficStatisticsBySource

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     entity_id: entity id - id author or template,
     access_token: users token,
     type: type traffic statistics - author or template,
     date_from: date start for statistics,
     date_to: date end for statistics,
     group: Statistic grouping, default day,
     country: Get statistic filtered by country iso2code
     source: Get statistic filtered by source,
     perPage: Max statistic per one page (20 by default, 50 is max size),
     page: Page number to view,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getSaleStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getStatisticsTrafficChannelsList

Request Services

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getStatisticsTrafficChannelsList(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getTotalSaleStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     author_user_id: authors id,
     access_token: users token,
     date_from: date start for total statistics,
     date_to: date end for total statistics,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getTotalSaleStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getTotalProductStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     author_user_id: authors id,
     product_ids: List of Product Id,
     access_token: users token,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getTotalProductStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getStatisticsTransactionsInfo

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     date_from: date start for total statistics: format 20200723,
     date_to: date end for total statistics: format 20200726,
     types: types of transactions (sale,refund,withdraw),
     country: country of transactions,
     perPage: count items of page,
     page: number of page,
     format: response format,
     access_token: authors token,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getStatisticsTransactionsInfo(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getMinYearStatistics

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     author_user_id: author user id,
     type_view: in what stats search,
     entity_type: what type id for filter set,
     entity_id: entity id - id author or template,
     access_token: users token,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getMinYearStatistics(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getStatisticsProductDiscounts

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     template_id: Show data for this product,
     date_from: Start day in period for get statistic,
     date_to: End day in period for get statistic,
     access_token: users token,
     locale: locale,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getStatisticsProductDiscounts(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>** 

## getStatisticsProductBoosts

Request Services

### Parameters

-   `params` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** {
     template_id: Show data for this product,
     date_from: Start day in period for get statistic,
     date_to: End day in period for get statistic,
     access_token: users token,
    } (optional, default `{}`)

### Examples

```javascript
(async () => {
  const service = new Service('http://api.templatemonsterdev.com/statistics/v2/');
  const request = await service.getStatisticsProductBoosts(params);
})();
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)&lt;any>**