Skip to content

Commit

Permalink
Merge pull request #81 from electerious/develop
Browse files Browse the repository at this point in the history
v1.5.0
  • Loading branch information
electerious authored Feb 16, 2020
2 parents c91d9c9 + 26d14d2 commit a852cd7
Show file tree
Hide file tree
Showing 43 changed files with 2,491 additions and 2,599 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.5.0] - 2020-02-16

### Added

- Ackee can track detailed data ([optional](https://github.com/electerious/ackee-tracker#options)) and now shows more of them in the "Detailed"-menu

## [1.4.3] - 2020-01-12

### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Make sure to install and update all dependencies before you setup Ackee.
- [/domains/:domainId/referrers](docs/referrers.md)
- [/domains/:domainId/durations](docs/durations.md)
- [/domains/:domainId/languages](docs/languages.md)
- [/domains/:domainId/sizes](docs/sizes.md)

### Options

Expand Down
154 changes: 154 additions & 0 deletions docs/sizes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Sizes

- [Get browser width](#get-browser-width)
- [Get browser height](#get-browser-height)
- [Get screen width](#get-screen-width)
- [Get screen height](#get-screen-height)

## Get browser width

Get the top 25 browser widths of the last 7 days.

### Request

```
GET /domains/:domainId/sizes?type=browser_width
```

### Headers

| Name | Example |
|:-----------|:------------|
| Authorization | `Authorization: Bearer :tokenId` |

### Response

```
Status: 200 OK
```

```json
{
"type": "sizes",
"data": [
{
"type": "size",
"data": {
"id": "1920",
"count": 1
}
}
]
}
```

## Get browser height

Get the top 25 browser heights of the last 7 days.

### Request

```
GET /domains/:domainId/sizes?type=browser_height
```

### Headers

| Name | Example |
|:-----------|:------------|
| Authorization | `Authorization: Bearer :tokenId` |

### Response

```
Status: 200 OK
```

```json
{
"type": "sizes",
"data": [
{
"type": "size",
"data": {
"id": "1080",
"count": 1
}
}
]
}
```

## Get screen width

Get the top 25 screen widths of the last 7 days.

### Request

```
GET /domains/:domainId/sizes?type=screen_width
```

### Headers

| Name | Example |
|:-----------|:------------|
| Authorization | `Authorization: Bearer :tokenId` |

### Response

```
Status: 200 OK
```

```json
{
"type": "sizes",
"data": [
{
"type": "size",
"data": {
"id": "1920",
"count": 1
}
}
]
}
```

## Get screen height

Get the top 25 screen heights of the last 7 days.

### Request

```
GET /domains/:domainId/sizes?type=height
```

### Headers

| Name | Example |
|:-----------|:------------|
| Authorization | `Authorization: Bearer :tokenId` |

### Response

```
Status: 200 OK
```

```json
{
"type": "sizes",
"data": [
{
"type": "size",
"data": {
"id": "1080",
"count": 1
}
}
]
}
```
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ackee",
"private": true,
"version": "1.4.3",
"version": "1.5.0",
"authors": [
"Tobias Reich <tobias@electerious.com>"
],
Expand Down Expand Up @@ -29,26 +29,27 @@
"extends": "@electerious/eslint-config"
},
"dependencies": {
"@babel/core": "^7.8.0",
"@babel/preset-env": "^7.8.0",
"@babel/core": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"ackee-tracker": "^3.2.2",
"classnames": "^2.2.6",
"dotenv": "^8.2.0",
"formbase": "^11.0.0",
"immer": "^5.2.1",
"formbase": "^12.0.0",
"immer": "^5.3.2",
"is-url": "^1.2.4",
"micro": "^9.3.4",
"microrouter": "^3.1.3",
"mongoose": "^5.8.7",
"mongoose": "^5.8.9",
"node-fetch": "^2.6.0",
"node-schedule": "^1.3.2",
"normalize-url": "^4.5.0",
"normalize-url": "^5.0.0",
"normalize.css": "^8.0.0",
"permit": "^0.2.4",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.3",
"react-use": "^13.26.0",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0",
Expand All @@ -58,11 +59,11 @@
"s-ago": "^2.1.0",
"shortid": "^2.2.15",
"signale": "^1.4.0",
"uuid": "^3.3.3"
"uuid": "^3.4.0"
},
"devDependencies": {
"@electerious/eslint-config": "^1.3.1",
"ava": "2.4.0",
"ava": "3.3.0",
"coveralls": "^3.0.9",
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.20.0",
Expand All @@ -74,7 +75,6 @@
"test-listen": "^1.1.0"
},
"ava": {
"babel": false,
"verbose": true,
"environmentVariables": {
"ACKEE_TRACKER": "custom name"
Expand Down
13 changes: 13 additions & 0 deletions src/constants/sizes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Constants will be shared between client and server.
// They will be used as values in the DOM and in the URL of the referrer calls.
const SIZES_TYPE_BROWSER_WIDTH = 'browser_width'
const SIZES_TYPE_BROWSER_HEIGHT = 'browser_height'
const SIZES_TYPE_SCREEN_WIDTH = 'screen_width'
const SIZES_TYPE_SCREEN_HEIGHT = 'screen_height'

module.exports = {
SIZES_TYPE_BROWSER_WIDTH,
SIZES_TYPE_BROWSER_HEIGHT,
SIZES_TYPE_SCREEN_WIDTH,
SIZES_TYPE_SCREEN_HEIGHT
}
65 changes: 8 additions & 57 deletions src/database/languages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict'

const Record = require('../schemas/Record')
const dateWithOffset = require('../utils/dateWithOffset')
const aggregateTopFields = require('../utils/aggregateTopFields')
const aggregateRecentFields = require('../utils/aggregateRecentFields')

const {
LANGUAGES_SORTING_TOP,
Expand All @@ -10,67 +11,17 @@ const {

const getTop = async (id) => {

return Record.aggregate([
{
$match: {
domainId: id,
siteLanguage: {
$ne: null
},
created: {
$gte: dateWithOffset(-6)
}
}
},
{
$group: {
_id: '$siteLanguage',
count: {
$sum: 1
}
}
},
{
$sort: {
count: -1
}
},
{
$limit: 25
}
])
return Record.aggregate(
aggregateTopFields(id, 'siteLanguage')
)

}

const getRecent = async (id) => {

return Record.aggregate([
{
$match: {
domainId: id,
siteLanguage: {
$ne: null
},
created: {
$gte: dateWithOffset(-6)
}
}
},
{
$sort: {
created: -1
}
},
{
$project: {
_id: '$siteLanguage',
created: '$created'
}
},
{
$limit: 25
}
])
return Record.aggregate(
aggregateRecentFields(id, 'siteLanguage')
)

}

Expand Down
Loading

0 comments on commit a852cd7

Please sign in to comment.