Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

last 90 days -> last 91 days (#5301)

RobertJoonas087b6e77bc8a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8ae5b58907..28c951b4c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
### Added
- Ability to sort by and compare the `exit_rate` metric in the dashboard Exit Pages > Details report
- Add top 3 pages into the traffic spike email
-- Two new shorthand time periods `28d` and `90d` available on both dashboard and in public API
+- Two new shorthand time periods `28d` and `91d` available on both dashboard and in public API
- Average scroll depth metric
- Scroll Depth goals
- Dashboard shows comparisons for all reports
diff --git a/assets/js/dashboard/nav-menu/query-periods/query-dates.test.tsx b/assets/js/dashboard/nav-menu/query-periods/query-dates.test.tsx
index f0b3dec87d..c6a543d6ab 100644
--- a/assets/js/dashboard/nav-menu/query-periods/query-dates.test.tsx
+++ b/assets/js/dashboard/nav-menu/query-periods/query-dates.test.tsx
@@ -28,7 +28,7 @@ test('if no period is stored, loads with default value of "Last 28 days", all ex
['Realtime', 'R'],
['Last 7 Days', 'W'],
['Last 28 Days', 'F'],
- ['Last 90 Days', 'N'],
+ ['Last 91 Days', 'N'],
['Month to Date', 'M'],
['Last Month', 'P'],
['Year to Date', 'Y'],
diff --git a/assets/js/dashboard/query-time-periods.ts b/assets/js/dashboard/query-time-periods.ts
index dfaf9cab2e..ba81f45046 100644
--- a/assets/js/dashboard/query-time-periods.ts
+++ b/assets/js/dashboard/query-time-periods.ts
@@ -32,7 +32,7 @@ export enum QueryPeriod {
'7d' = '7d',
'28d' = '28d',
'30d' = '30d',
- '90d' = '90d',
+ '91d' = '91d',
'6mo' = '6mo',
'12mo' = '12mo',
'year' = 'year',
@@ -361,15 +361,15 @@ export const getDatePeriodGroups = ({
}
],
[
- ['Last 90 Days', 'N'],
+ ['Last 91 Days', 'N'],
{
search: (s) => ({
...s,
...clearedDateSearch,
- period: QueryPeriod['90d'],
+ period: QueryPeriod['91d'],
keybindHint: 'N'
}),
- isActive: ({ query }) => query.period === QueryPeriod['90d'],
+ isActive: ({ query }) => query.period === QueryPeriod['91d'],
onEvent
}
]
@@ -611,8 +611,8 @@ export function getCurrentPeriodDisplayName({
if (query.period === '30d') {
return 'Last 30 days'
}
- if (query.period === '90d') {
- return 'Last 90 days'
+ if (query.period === '91d') {
+ return 'Last 91 days'
}
if (query.period === 'month') {
if (isThisMonth(site, query.date)) {
diff --git a/assets/js/dashboard/site-context.test.tsx b/assets/js/dashboard/site-context.test.tsx
index a73d846cba..8b5f16c3b0 100644
--- a/assets/js/dashboard/site-context.test.tsx
+++ b/assets/js/dashboard/site-context.test.tsx
@@ -30,7 +30,7 @@ describe('parseSiteFromDataset', () => {
data-current-user-role="owner"
data-current-user-id="1"
data-flags="{}"
- data-valid-intervals-by-period='{"12mo":["day","week","month"],"7d":["hour","day"],"28d":["day","week"],"30d":["day","week"],"90d":["day","week","month"],"6mo":["day","week","month"],"all":["week","month"],"custom":["day","week","month"],"day":["minute","hour"],"month":["day","week"],"realtime":["minute"],"year":["day","week","month"]}'
+ data-valid-intervals-by-period='{"12mo":["day","week","month"],"7d":["hour","day"],"28d":["day","week"],"30d":["day","week"],"91d":["day","week","month"],"6mo":["day","week","month"],"all":["week","month"],"custom":["day","week","month"],"day":["minute","hour"],"month":["day","week"],"realtime":["minute"],"year":["day","week","month"]}'
{...attrs}
/>
)
@@ -58,7 +58,7 @@ describe('parseSiteFromDataset', () => {
'7d': ['hour', 'day'],
'28d': ['day', 'week'],
'30d': ['day', 'week'],
- '90d': ['day', 'week', 'month'],
+ '91d': ['day', 'week', 'month'],
'6mo': ['day', 'week', 'month'],
all: ['week', 'month'],
custom: ['day', 'week', 'month'],
diff --git a/assets/js/types/query-api.d.ts b/assets/js/types/query-api.d.ts
index d73fa18153..af690bb85c 100644
--- a/assets/js/types/query-api.d.ts
+++ b/assets/js/types/query-api.d.ts
@@ -24,7 +24,7 @@ export type DateRangeShorthand =
| "7d"
| "28d"
| "30d"
- | "90d"
+ | "91d"
| "month"
| "6mo"
| "12mo"
diff --git a/lib/plausible/stats/interval.ex b/lib/plausible/stats/interval.ex
index 3cbfab6f44..34018037fc 100644
--- a/lib/plausible/stats/interval.ex
+++ b/lib/plausible/stats/interval.ex
@@ -31,7 +31,7 @@ defmodule Plausible.Stats.Interval do
case period do
period when period in ["realtime", "30m"] -> "minute"
"day" -> "hour"
- period when period in ["custom", "7d", "28d", "30d", "90d", "month"] -> "day"
+ period when period in ["custom", "7d", "28d", "30d", "91d", "month"] -> "day"
period when period in ["6mo", "12mo", "year"] -> "month"
end
end
@@ -59,7 +59,7 @@ defmodule Plausible.Stats.Interval do
"7d" => ["hour", "day"],
"28d" => ["day", "week"],
"30d" => ["day", "week"],
- "90d" => ["day", "week", "month"],
+ "91d" => ["day", "week", "month"],
"month" => ["day", "week"],
"6mo" => ["day", "week", "month"],
"12mo" => ["day", "week", "month"],
diff --git a/lib/plausible/stats/legacy/legacy_query_builder.ex b/lib/plausible/stats/legacy/legacy_query_builder.ex
index 9ee542650f..f888ea66d0 100644
--- a/lib/plausible/stats/legacy/legacy_query_builder.ex
+++ b/lib/plausible/stats/legacy/legacy_query_builder.ex
@@ -93,7 +93,7 @@ defmodule Plausible.Stats.Legacy.QueryBuilder do
end
defp put_period(query, site, %{"period" => period} = params)
- when period in ["7d", "28d", "30d", "90d"] do
+ when period in ["7d", "28d", "30d", "91d"] do
{days, "d"} = Integer.parse(period)
end_date = parse_single_date(query, params) |> Date.shift(day: -1)
diff --git a/priv/json-schemas/query-api-schema.json b/priv/json-schemas/query-api-schema.json
index f0ce373b04..915273e26e 100644
--- a/priv/json-schemas/query-api-schema.json
+++ b/priv/json-schemas/query-api-schema.json
@@ -201,8 +201,8 @@
"description": "Last 30 days relative to today"
},
{
- "const": "90d",
- "description": "Last 90 days relative to today"
+ "const": "91d",
+ "description": "Last 91 days relative to today"
},
{
"const": "month",
diff --git a/test/plausible/stats/interval_test.exs b/test/plausible/stats/interval_test.exs
index b014d13b5c..204914a531 100644
--- a/test/plausible/stats/interval_test.exs
+++ b/test/plausible/stats/interval_test.exs
@@ -32,7 +32,7 @@ defmodule Plausible.Stats.IntervalTest do
"7d" => ["hour", "day"],
"28d" => ["day", "week"],
"30d" => ["day", "week"],
- "90d" => ["day", "week", "month"],
+ "91d" => ["day", "week", "month"],
"6mo" => ["day", "week", "month"],
"12mo" => ["day", "week", "month"],
"year" => ["day", "week", "month"],
@@ -51,7 +51,7 @@ defmodule Plausible.Stats.IntervalTest do
"7d" => ["hour", "day"],
"28d" => ["day", "week"],
"30d" => ["day", "week"],
- "90d" => ["day", "week", "month"],
+ "91d" => ["day", "week", "month"],
"6mo" => ["day", "week", "month"],
"12mo" => ["day", "week", "month"],
"year" => ["day", "week", "month"],
@@ -71,7 +71,7 @@ defmodule Plausible.Stats.IntervalTest do
"7d" => ["hour", "day"],
"28d" => ["day", "week"],
"30d" => ["day", "week"],
- "90d" => ["day", "week", "month"],
+ "91d" => ["day", "week", "month"],
"6mo" => ["day", "week", "month"],
"12mo" => ["day", "week", "month"],
"year" => ["day", "week", "month"],
diff --git a/test/plausible_web/controllers/api/external_stats_controller/query_comparisons_test.exs b/test/plausible_web/controllers/api/external_stats_controller/query_comparisons_test.exs
index 5ac02c88e7..ed584fcf9b 100644
--- a/test/plausible_web/controllers/api/external_stats_controller/query_comparisons_test.exs
+++ b/test/plausible_web/controllers/api/external_stats_controller/query_comparisons_test.exs
@@ -169,7 +169,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
assert actual_comparison_last_date == expected_comparison_last_date
end
- test "timeseries last 90d period in year_over_year comparison", %{
+ test "timeseries last 91d period in year_over_year comparison", %{
conn: conn,
site: site
} do
@@ -178,19 +178,19 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
build(:pageview, timestamp: ~N[2021-04-01 00:00:00]),
build(:pageview, timestamp: ~N[2021-04-05 00:00:00]),
build(:pageview, timestamp: ~N[2021-04-05 00:00:00]),
- build(:pageview, timestamp: ~N[2021-06-29 00:00:00]),
+ build(:pageview, timestamp: ~N[2021-06-30 00:00:00]),
build(:pageview, timestamp: ~N[2022-04-01 00:00:00]),
build(:pageview, timestamp: ~N[2022-04-05 00:00:00]),
- build(:pageview, timestamp: ~N[2022-06-29 00:00:00]),
- build(:pageview, timestamp: ~N[2022-06-30 00:00:00])
+ build(:pageview, timestamp: ~N[2022-06-30 00:00:00]),
+ build(:pageview, timestamp: ~N[2022-07-01 00:00:00])
])
conn =
post(conn, "/api/v2/query-internal-test", %{
"site_id" => site.domain,
"metrics" => ["visitors"],
- "date_range" => "90d",
- "date" => "2022-06-30",
+ "date_range" => "91d",
+ "date" => "2022-07-01",
"dimensions" => ["time:day"],
"include" => %{
"time_labels" => true,
@@ -205,7 +205,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
assert "2022-04-01" = List.first(time_labels)
assert "2022-04-05" = Enum.at(time_labels, 4)
- assert "2022-06-29" = List.last(time_labels)
+ assert "2022-06-30" = List.last(time_labels)
assert %{
"dimensions" => ["2022-04-01"],
@@ -226,13 +226,13 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryComparisonsTest do
} = Enum.find(results, &(&1["dimensions"] == ["2022-04-05"]))
assert %{
- "dimensions" => ["2022-06-29"],
+ "dimensions" => ["2022-06-30"],
"metrics" => [1],
"comparison" => %{
- "dimensions" => ["2021-06-29"],
+ "dimensions" => ["2021-06-30"],
"metrics" => [1]
}
- } = Enum.find(results, &(&1["dimensions"] == ["2022-06-29"]))
+ } = Enum.find(results, &(&1["dimensions"] == ["2022-06-30"]))
end
test "dimensional comparison with low limit", %{conn: conn, site: site} do
diff --git a/test/plausible_web/controllers/api/stats_controller/main_graph_test.exs b/test/plausible_web/controllers/api/stats_controller/main_graph_test.exs
index fb070e82fc..e8b7ec75e0 100644
--- a/test/plausible_web/controllers/api/stats_controller/main_graph_test.exs
+++ b/test/plausible_web/controllers/api/stats_controller/main_graph_test.exs
@@ -167,21 +167,21 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
assert Enum.sum(plot) == 2
end
- test "displays visitors for last 90d", %{conn: conn, site: site} do
+ test "displays visitors for last 91d", %{conn: conn, site: site} do
populate_stats(site, [
build(:pageview, timestamp: ~N[2021-01-16 00:00:00]),
- build(:pageview, timestamp: ~N[2021-04-15 00:00:00])
+ build(:pageview, timestamp: ~N[2021-04-16 00:00:00])
])
conn =
get(
conn,
- "/api/stats/#{site.domain}/main-graph?period=90d&date=2021-04-16&metric=visitors"
+ "/api/stats/#{site.domain}/main-graph?period=91d&date=2021-04-17&metric=visitors"
)
assert %{"plot" => plot} = json_response(conn, 200)
- assert Enum.count(plot) == 90
+ assert Enum.count(plot) == 91
assert List.first(plot) == 1
assert List.last(plot) == 1
assert Enum.sum(plot) == 2
@@ -1276,14 +1276,14 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
}
end
- test "shows imperfect month-split for last 90d with full month indicators", %{
+ test "shows imperfect month-split for last 91d with full month indicators", %{
conn: conn,
site: site
} do
conn =
get(
conn,
- "/api/stats/#{site.domain}/main-graph?period=90d&metric=visitors&interval=month&date=2021-12-13"
+ "/api/stats/#{site.domain}/main-graph?period=91d&metric=visitors&interval=month&date=2021-12-13"
)
assert %{"labels" => labels, "full_intervals" => full_intervals} = json_response(conn, 200)
@@ -1298,14 +1298,14 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
}
end
- test "shows half-perfect month-split for last 90d with full month indicators", %{
+ test "shows perfect month-split for last 91d with full month indicators", %{
conn: conn,
site: site
} do
conn =
get(
conn,
- "/api/stats/#{site.domain}/main-graph?period=90d&metric=visitors&interval=month&date=2021-12-01"
+ "/api/stats/#{site.domain}/main-graph?period=91d&metric=visitors&interval=month&date=2021-12-01"
)
assert %{"labels" => labels, "full_intervals" => full_intervals} = json_response(conn, 200)
@@ -1313,7 +1313,7 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
assert labels == ["2021-09-01", "2021-10-01", "2021-11-01"]
assert full_intervals == %{
- "2021-09-01" => false,
+ "2021-09-01" => true,
"2021-10-01" => true,
"2021-11-01" => true
}
@@ -1863,7 +1863,7 @@ defmodule PlausibleWeb.Api.StatsController.MainGraphTest do
refute present_index
end
- for period <- ["7d", "28d", "30d", "90d"] do
+ for period <- ["7d", "28d", "30d", "91d"] do
test "#{period} period does not include today", %{conn: conn, site: site} do
today = "2021-01-01"
yesterday = "2020-12-31"