Skip to content

Commit a852cd7

Browse files
authored
Merge pull request #81 from electerious/develop
v1.5.0
2 parents c91d9c9 + 26d14d2 commit a852cd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2491
-2599
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
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).
66

7+
## [1.5.0] - 2020-02-16
8+
9+
### Added
10+
11+
- Ackee can track detailed data ([optional](https://github.com/electerious/ackee-tracker#options)) and now shows more of them in the "Detailed"-menu
12+
713
## [1.4.3] - 2020-01-12
814

915
### Added

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ Make sure to install and update all dependencies before you setup Ackee.
8484
- [/domains/:domainId/referrers](docs/referrers.md)
8585
- [/domains/:domainId/durations](docs/durations.md)
8686
- [/domains/:domainId/languages](docs/languages.md)
87+
- [/domains/:domainId/sizes](docs/sizes.md)
8788

8889
### Options
8990

Diff for: docs/sizes.md

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Sizes
2+
3+
- [Get browser width](#get-browser-width)
4+
- [Get browser height](#get-browser-height)
5+
- [Get screen width](#get-screen-width)
6+
- [Get screen height](#get-screen-height)
7+
8+
## Get browser width
9+
10+
Get the top 25 browser widths of the last 7 days.
11+
12+
### Request
13+
14+
```
15+
GET /domains/:domainId/sizes?type=browser_width
16+
```
17+
18+
### Headers
19+
20+
| Name | Example |
21+
|:-----------|:------------|
22+
| Authorization | `Authorization: Bearer :tokenId` |
23+
24+
### Response
25+
26+
```
27+
Status: 200 OK
28+
```
29+
30+
```json
31+
{
32+
"type": "sizes",
33+
"data": [
34+
{
35+
"type": "size",
36+
"data": {
37+
"id": "1920",
38+
"count": 1
39+
}
40+
}
41+
]
42+
}
43+
```
44+
45+
## Get browser height
46+
47+
Get the top 25 browser heights of the last 7 days.
48+
49+
### Request
50+
51+
```
52+
GET /domains/:domainId/sizes?type=browser_height
53+
```
54+
55+
### Headers
56+
57+
| Name | Example |
58+
|:-----------|:------------|
59+
| Authorization | `Authorization: Bearer :tokenId` |
60+
61+
### Response
62+
63+
```
64+
Status: 200 OK
65+
```
66+
67+
```json
68+
{
69+
"type": "sizes",
70+
"data": [
71+
{
72+
"type": "size",
73+
"data": {
74+
"id": "1080",
75+
"count": 1
76+
}
77+
}
78+
]
79+
}
80+
```
81+
82+
## Get screen width
83+
84+
Get the top 25 screen widths of the last 7 days.
85+
86+
### Request
87+
88+
```
89+
GET /domains/:domainId/sizes?type=screen_width
90+
```
91+
92+
### Headers
93+
94+
| Name | Example |
95+
|:-----------|:------------|
96+
| Authorization | `Authorization: Bearer :tokenId` |
97+
98+
### Response
99+
100+
```
101+
Status: 200 OK
102+
```
103+
104+
```json
105+
{
106+
"type": "sizes",
107+
"data": [
108+
{
109+
"type": "size",
110+
"data": {
111+
"id": "1920",
112+
"count": 1
113+
}
114+
}
115+
]
116+
}
117+
```
118+
119+
## Get screen height
120+
121+
Get the top 25 screen heights of the last 7 days.
122+
123+
### Request
124+
125+
```
126+
GET /domains/:domainId/sizes?type=height
127+
```
128+
129+
### Headers
130+
131+
| Name | Example |
132+
|:-----------|:------------|
133+
| Authorization | `Authorization: Bearer :tokenId` |
134+
135+
### Response
136+
137+
```
138+
Status: 200 OK
139+
```
140+
141+
```json
142+
{
143+
"type": "sizes",
144+
"data": [
145+
{
146+
"type": "size",
147+
"data": {
148+
"id": "1080",
149+
"count": 1
150+
}
151+
}
152+
]
153+
}
154+
```

Diff for: package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ackee",
33
"private": true,
4-
"version": "1.4.3",
4+
"version": "1.5.0",
55
"authors": [
66
"Tobias Reich <[email protected]>"
77
],
@@ -29,26 +29,27 @@
2929
"extends": "@electerious/eslint-config"
3030
},
3131
"dependencies": {
32-
"@babel/core": "^7.8.0",
33-
"@babel/preset-env": "^7.8.0",
32+
"@babel/core": "^7.8.3",
33+
"@babel/preset-env": "^7.8.3",
3434
"ackee-tracker": "^3.2.2",
3535
"classnames": "^2.2.6",
3636
"dotenv": "^8.2.0",
37-
"formbase": "^11.0.0",
38-
"immer": "^5.2.1",
37+
"formbase": "^12.0.0",
38+
"immer": "^5.3.2",
3939
"is-url": "^1.2.4",
4040
"micro": "^9.3.4",
4141
"microrouter": "^3.1.3",
42-
"mongoose": "^5.8.7",
42+
"mongoose": "^5.8.9",
4343
"node-fetch": "^2.6.0",
4444
"node-schedule": "^1.3.2",
45-
"normalize-url": "^4.5.0",
45+
"normalize-url": "^5.0.0",
4646
"normalize.css": "^8.0.0",
4747
"permit": "^0.2.4",
4848
"prop-types": "^15.7.2",
4949
"react": "^16.12.0",
5050
"react-dom": "^16.12.0",
5151
"react-redux": "^7.1.3",
52+
"react-use": "^13.26.0",
5253
"redux": "^4.0.5",
5354
"redux-devtools-extension": "^2.13.8",
5455
"redux-thunk": "^2.3.0",
@@ -58,11 +59,11 @@
5859
"s-ago": "^2.1.0",
5960
"shortid": "^2.2.15",
6061
"signale": "^1.4.0",
61-
"uuid": "^3.3.3"
62+
"uuid": "^3.4.0"
6263
},
6364
"devDependencies": {
6465
"@electerious/eslint-config": "^1.3.1",
65-
"ava": "2.4.0",
66+
"ava": "3.3.0",
6667
"coveralls": "^3.0.9",
6768
"eslint": "^6.8.0",
6869
"eslint-plugin-import": "^2.20.0",
@@ -74,7 +75,6 @@
7475
"test-listen": "^1.1.0"
7576
},
7677
"ava": {
77-
"babel": false,
7878
"verbose": true,
7979
"environmentVariables": {
8080
"ACKEE_TRACKER": "custom name"

Diff for: src/constants/sizes.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Constants will be shared between client and server.
2+
// They will be used as values in the DOM and in the URL of the referrer calls.
3+
const SIZES_TYPE_BROWSER_WIDTH = 'browser_width'
4+
const SIZES_TYPE_BROWSER_HEIGHT = 'browser_height'
5+
const SIZES_TYPE_SCREEN_WIDTH = 'screen_width'
6+
const SIZES_TYPE_SCREEN_HEIGHT = 'screen_height'
7+
8+
module.exports = {
9+
SIZES_TYPE_BROWSER_WIDTH,
10+
SIZES_TYPE_BROWSER_HEIGHT,
11+
SIZES_TYPE_SCREEN_WIDTH,
12+
SIZES_TYPE_SCREEN_HEIGHT
13+
}

Diff for: src/database/languages.js

+8-57
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict'
22

33
const Record = require('../schemas/Record')
4-
const dateWithOffset = require('../utils/dateWithOffset')
4+
const aggregateTopFields = require('../utils/aggregateTopFields')
5+
const aggregateRecentFields = require('../utils/aggregateRecentFields')
56

67
const {
78
LANGUAGES_SORTING_TOP,
@@ -10,67 +11,17 @@ const {
1011

1112
const getTop = async (id) => {
1213

13-
return Record.aggregate([
14-
{
15-
$match: {
16-
domainId: id,
17-
siteLanguage: {
18-
$ne: null
19-
},
20-
created: {
21-
$gte: dateWithOffset(-6)
22-
}
23-
}
24-
},
25-
{
26-
$group: {
27-
_id: '$siteLanguage',
28-
count: {
29-
$sum: 1
30-
}
31-
}
32-
},
33-
{
34-
$sort: {
35-
count: -1
36-
}
37-
},
38-
{
39-
$limit: 25
40-
}
41-
])
14+
return Record.aggregate(
15+
aggregateTopFields(id, 'siteLanguage')
16+
)
4217

4318
}
4419

4520
const getRecent = async (id) => {
4621

47-
return Record.aggregate([
48-
{
49-
$match: {
50-
domainId: id,
51-
siteLanguage: {
52-
$ne: null
53-
},
54-
created: {
55-
$gte: dateWithOffset(-6)
56-
}
57-
}
58-
},
59-
{
60-
$sort: {
61-
created: -1
62-
}
63-
},
64-
{
65-
$project: {
66-
_id: '$siteLanguage',
67-
created: '$created'
68-
}
69-
},
70-
{
71-
$limit: 25
72-
}
73-
])
22+
return Record.aggregate(
23+
aggregateRecentFields(id, 'siteLanguage')
24+
)
7425

7526
}
7627

0 commit comments

Comments
 (0)