Commit Graph

3789 Commits

Author SHA1 Message Date
Cenk Kücük b879c2d30b
Add kernel settings for non-selfhosted envs (#5734) 2025-09-17 19:13:17 +00:00
Sanne de Vries 897d3c5044
Clean up number formatting util (#5725)
* Clean up number formatting util

- Deduplicate number_format util
- Add tests for number_format util
- Add number formatting to visitor change percentage in site overview

* Move number_format to TextHelpers

- Move number_format to a more generic place in TextHelpers
- Revert the places where we use unlimited to use the inline util
2025-09-17 07:40:40 +00:00
Adrian Gruntkowski 4754e2a3e8
Remove SSO_ENABLED env flag and replace it with ee? checks where needed (#5728)
* Remove `SSO_ENABLED` env flag and replace it with `ee?` checks where needed

* Fix name of a test module to avoid clash

* Remove unnecessary `ee?()` check from condition in `extra/` code
2025-09-16 14:18:59 +00:00
Sanne de Vries 32fa20cfb1
Make visual tweaks to the dashboard (#5726)
* Make visual tweaks to the dashboard

- Reduce shadow and increased border radius on cards, to be consistent with the rest of the app
- Reduce logo size
- Align horizontal and vertical spacing between cards
- Reduce line width of the main graph
- Fix horizontal alignment on tables
- Reduce border radius on sites overview for consistency with dashboard
- Add transition to hover effect on sites overview cards

* Remove negative margin from logo to ensure vertical centering

- The negative margin on the logo caused misalignment with the rest of the header
2025-09-16 13:57:20 +00:00
Adam Rutkowski ad46776f9f
Use fragment to bind list of ids as a single param (#5730)
* WIP

* Alternative approach to OG approach (h/t @zoldar)

* Revert "WIP"

This reverts commit 7e3f0c1f8f.
2025-09-16 11:31:20 +00:00
Artur Pata b03569d762
Update tests transformRequest tests (#5687) 2025-09-16 05:39:17 +00:00
Artur Pata a0e5f801ff
Script v2: Maybe load installation type from DB (#5717)
* Maybe load installation type from DB

* Swap get_or_create... with get_tracker_script_configuration

* Fix getting saved_installation_type

* Add utility to htmlize quotes

* Update manual snippet not found error text

* Prevent custom URL input if scriptv2 not true

* Test verification v2 flows

* Fix import for CE test
2025-09-16 05:28:36 +00:00
Karl-Aksel Puulmann 1531386b76
FULL join for time:hour as well as time:minute (#5715)
* FULL join for time:hour as well as time:minute

Follow-up to https://github.com/plausible/analytics/pull/5694/files#r2321567271

A session might be active over multiple hours, but not (currently)
reported as such when requesting only specific metrics per hour.
This fixes that problem.

* Handle full join logic correctly

---------

Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2025-09-15 14:14:59 +00:00
RobertJoonas d02636dd07
POC: Rollup view (#5719)
* POC rollup dashboard

* add rollups to stats api

* remove the irrelevant new controller action

* use team_identifier instead of team_id
2025-09-15 11:51:37 +00:00
apata aceef2d6d3 Released tracker script version 0.4.3 2025-09-15 11:25:59 +00:00
Artur Pata cc5ca4b752
Script v2: Apply prettier (#5718)
* Apply prettier

* Fix issue with quotes in test setup

* Fix other issues with customSubmitHandlerStub

* Fix format with cookies fixtures
2025-09-15 11:21:27 +00:00
RobertJoonas 6e9bc6e2f1
do not crash dashboard when externalLinkForPage fails (#5724) 2025-09-15 11:13:01 +00:00
Artur Pata f7acb068d4
Script v2: Change priority of CSP related error for verifying manual installations (#5707)
* Add logic to find Plausible script tag

* Clarify where cookies fixtures come from

* Add case for snippet not found

* Fix issue with installation type not propagating to diagnostics

* Better struct definition

* Refactor verification tests to be more comprehensive

* Fix compile error related to Test.Support.DNS

* Fix DNS imports for CE

* Refactor when tracker is in HTML is detected
2025-09-11 06:59:03 +00:00
Adrian Gruntkowski 8d6d828d1d
Reduce reliance on `Timex` and use native time API where feasible (#5712)
* Replace usages of `Timex.to_unix` with native API

* Wrap call to `Timex.is_valid_timezone?`

* Wrap calls to `Timex.today(tz)`

* Replace `Timex.today()` with `Date.utc_today()`

* Replace `Timex.now()` with `DateTime.utc_now()`

* Replace `Timex.compare` with `Date.compare`

* Wrap `Timex.diff` calls

* Replace `Timex.Timezone.convert` with `DateTime.shift_zone!`

* Wrap `Timex.parse!`

* Replace `Timex.to_date` with native API calls

* Replace `Timex.beginning|end_of...` with native API calls for Date

* Wrap `Timex.beginning|end_of...` for DateTimes and Dates for years

* Replace `Timex.format(!)` with native API calls

* Replace `Timex.to_naive_datetime` with native API calls

* Wrap time humanizing routines using Timex

* Remove unnecessary `use Timex` instances

* Replace `Timex.shift` with native API calls

* Make `QueryParser.parse_date` handle gaps and ambiguities gracefully

* Replace `Timex.now(tz)` with `DateTime.now!(tz)`

* Use a more suitable Date function for comparison (h/t @aerosol)
2025-09-10 10:21:36 +00:00
RobertJoonas f3950b21aa
Improve v2 mobile onboarding experience + fix margins between paragraphs (#5709)
* render tabs in a 2x2 grid on mobile

* margins

* fix test
2025-09-09 17:28:06 +00:00
Adrian Gruntkowski 483f3508b9
Remove redundant link to site transfer from Site Settings > People (#5708) 2025-09-08 12:36:39 +00:00
Karl-Aksel Puulmann 60a47f3362
Fix: time series trimming (#5705)
* Fix time series trimming

https://github.com/plausible/analytics/pull/5699 accidentally broke time
series trimming on main graph

It tried to remove a seemingly redundant Query.optimize call, but this
was implicitly needed for time labels functionality.

* Add testing tools, test timeseries better

Tool lifted from https://github.com/plausible/analytics/pull/5680

* Minor cleanup
2025-09-08 11:15:35 +00:00
Artur Pata 6a9fe4573c
Script v2: Rate limit tech detection (#5701)
* Rate limit tech detection

* Add tests

* Fix tests

* Unify rate limit key format

* Move capture log to tags
2025-09-08 11:14:07 +00:00
Karl-Aksel Puulmann db448d7404
Stats: Rebuild session smearing for timeseries (#5694)
* Refactor table_decider#partition_metrics

* Refactor query pipeline to return a list of subqueries after splitting

* Move order_by out of join logic

* Refactor joining logic in query_builder

1. JOIN type is now set in QueryOptimizer
2. JOIN logic is now table and list-size agnostic

* Comment an edge case

* Rebuild session/visit smearing

Previously, whenever graphing any visit metric hourly/realtime, visit_duration and other
visit metrics would be way higher than expected, due to long sessions
dragging each bucket up and up. Now visits/visitors metrics are still
smeared and other visit metrics are counted under last bucket user was
active in.

visits metric was also overcounted (see new tests).

* Remove unneeded case

* Unit test for smearing in tabledecider
2025-09-08 06:21:12 +00:00
Karl-Aksel Puulmann bf24ae0cd2
APIv2: Use `Query.build` over `Query.from` in more cases (#5699)
* Query.from -> Query.build

* Update LegacyQueryBuilder docs

* Build query instead of mutating it

* Remove redundant QueryOptimizer calls (already called within .run())
2025-09-04 12:25:09 +00:00
Karl-Aksel Puulmann 6216ade4ee
Trim comparisons for year/month (#5702) 2025-09-04 10:28:04 +00:00
Karl-Aksel Puulmann 9af40a278d
Trim month, year, day periods to local now on main graph (#5698)
* Revert "Revert "Trim `month`, `year`, `day` periods to local now on main graph (#5668)" (#5684)"

This reverts commit 2d11681f25.

* Does not trim for comparisons

* Include the current hour in the trimmed time range
2025-09-04 09:13:17 +00:00
Artur Pata 88fccb6972
Script v2: Show "Plausible not detected" errors with installation type specific recommendations (#5693)
* Show Plausible not detected errors with installation type specific recommendations

* Update diagnostics and diagnostics tests for verification

* Format

* Stop calling statuses between 200..299 as errors

* Remove function that populates diagnostics randomly
2025-09-04 06:24:37 +00:00
apata ddc98670db Released tracker script version 0.4.2 2025-09-04 05:00:50 +00:00
Artur Pata 757cf95070
Script v2: Adds linter and prettier, satisfies linter (#5691)
* Install deps and create config

* Satisfy linter in tests

* Silence redeclare warnings

* Remove shadowed/redeclared variables

* Update changelog
2025-09-04 04:56:42 +00:00
RobertJoonas 110f97d442
CE: Fix v2 onboarding, review installation, and domain change flows (#5692)
* fix seeds.exs for CE

* unified FF function

* remove gtm tab on ce

* CE change domain flow: remove detection logic

* CE installationv2 (review & provisioning flows) + tests

* change domain tests

* fix tests

* FF for user too

* small improvements (review comments)

* keep the CE and EE versions of the same function together
2025-09-03 17:22:18 +00:00
Adrian Gruntkowski 3d12ced6ff
Retry on HTTP2 `:unprocessed` error in `Persistor.Remote` (#5697) 2025-09-03 08:09:09 +00:00
Adrian Gruntkowski aa803e7e45
Retry persistor requests on HTTP2 disconnected errors (#5695) 2025-09-02 16:16:30 +00:00
Adam Rutkowski 67674b984b
Replace Search Console property select with ComboBox (#5689) 2025-09-01 13:07:07 +00:00
Adrian Gruntkowski 3fbea514a6
Use embedded persistor implementation in local dev env (#5688) 2025-09-01 11:34:25 +00:00
Karl-Aksel Puulmann 7b1c8af902
Update links in instructions (#5686) 2025-09-01 10:12:06 +00:00
Adrian Gruntkowski 40ff36a4fb
Implement dedicated persistence service (#5653)
* Implement a very crude HTTP relay to persistor service

* Temporarily disable local session and event persistence

* Temporarily disable Promex in dev

* Setup dedicated Finch pool for persistor

* Temporarily adjust load script parameters

* Fiddle with pool opts

* Only log errors

* Bump rate

* Put persistor configuration in runtime config

* Move persistor client code to a separate module

* Move event and session persistence behind a switchable adapter

* Add scaffolding of relaying persistor

* Instrument relayed persistence

* Adjust persistor API to accept full ingest event

* Fix persistor URL in config defaults

* Switch local dev env of embedded_with_relay backend

* Revert "Temporarily disable Promex in dev"

This reverts commit d9c9e9075d130cc5177a2a7559b98a2026077327.

* Lower default `PERSISTOR_COUNT`

* Refactor payload encoding and decoding slightly

* Test and slightly improve persistor logic
2025-09-01 09:13:41 +00:00
apata 91e60fe148 Released tracker script version 0.4.1 2025-09-01 05:59:11 +00:00
Artur Pata af06df806b
Script v2: Verifier accepts cookies (#5669)
* Accept cookies (WIP)

* Make resolving Plausible function call a priority

* Update tracker script version

* Remove cookieBannerLikely, replace with debug-only cookiesConsentResult

* Use compact rules

* Make verifier tests less flaky

* Add fixtures for accepting cookies

* Limit CMPs

* Fix dep position
2025-09-01 05:54:19 +00:00
Adrian Gruntkowski 2d11681f25
Revert "Trim `month`, `year`, `day` periods to local now on main graph (#5668)" (#5684)
This reverts commit 563c3d22ba.
2025-08-28 14:58:57 +00:00
Adrian Gruntkowski 70c9a55bf8
Add custom props to full export (#5666)
* Add custom props to full export

* Pass full `site` struct to `export_queries`

* Export only internal props if plan lacks custom props

* Add changelog entry

* Add spot check test for custom props

* Do not generate cartesian product of prop/value pairs 🤦
2025-08-28 13:13:01 +00:00
RobertJoonas 4548e3acc5
Verification: new interpretation case for non-200 page responses (#5683)
* allow http scheme in verification url

* skip dns lookups on localhost URLs in dev env

* handle non-200 page responses

* fix test

* Update lib/plausible/installation_support/verification/diagnostics.ex

Co-authored-by: Artur Pata <artur.pata@gmail.com>

* shorten_url fn

* remove dot

* fix assertions

---------

Co-authored-by: Artur Pata <artur.pata@gmail.com>
2025-08-28 11:54:03 +00:00
Adam Rutkowski 563c3d22ba
Trim `month`, `year`, `day` periods to local now on main graph (#5668)
* Trim `month`, `year`, `day` periods to now on main graph

* Revert "Trim `month`, `year`, `day` periods to now on main graph"

This reverts commit 4f3930111d3a2737a51686e067d9b64f0d85ad58.

* Re-implement trimming in query optimizer instead

* Update JS types

* This is getting confusing

* Trim in stats_controller

* Set `query.now` based on query_praser and date results

* query.period -> query.input_date_range

* Changelog

* Test for response query.date_range

---------

Co-authored-by: Karl-Aksel Puulmann <oxymaccy@gmail.com>
2025-08-28 09:51:56 +00:00
Adrian Gruntkowski f94aebc00b
Make "last N months" return date ranges consistent with "last N days" (#5677)
* Make "last N months" return date ranges consistent with "last N days"

* Make goal suggestions not rely on predefined period

* Use native `Date` API for calculating beginning and end of months
2025-08-28 09:10:49 +00:00
Adrian Gruntkowski eed90a343e
Refactor free billing features logic (#5682) 2025-08-27 17:29:05 +00:00
Adam Rutkowski b48463ca65
CRM: Expose Team SSO Policy (#5681)
* CRM: Expose Team SSO Policy

* Flip ordering for audit log entries
2025-08-27 12:20:27 +00:00
RobertJoonas 3b4342112f
show messages while waiting for detection (#5667) 2025-08-27 11:58:17 +00:00
Adrian Gruntkowski 54641ccea6
Make generated iframe embed code work well with transparent background (#5672)
* Explicitly declare color scheme availability and preference

* Revert "Explicitly declare color scheme availability and preference"

This reverts commit e1e6242d29.

* Add `color-scheme: auto;` to generated iframe embed code
2025-08-27 11:36:05 +00:00
RobertJoonas c3af79a115
Verification v2: Better Browserless error handling + verify custom URL option (#5673)
* interpret browserless network errors better

* refactor: split verification component render fn

* Custom URL input + render attempted URL in error message

* move socket assign around

* add tests

* drop redundant else branch + guard

* socket assigns out of launch_delayed

* template strings and define error structs at compile time

* typo in test comment

* fix function args
2025-08-27 11:25:47 +00:00
Adrian Gruntkowski a2c863b2cc
Ignore `visit:channel` when transforming filters for GSC (#5678) 2025-08-27 11:08:15 +00:00
Adam Rutkowski 69206475f9
Instrument missing mock to mute expectation error (#5675)
* Instrument missing mock to mute expectation error

* Format
2025-08-27 05:57:42 +00:00
Adam Rutkowski ecfea36bd9
Avoid slowdowns in tests due to code server waits (#5674)
This is supposed to be taken care of
by d05731194e
but not quite it seems.

The first test with a fairly involved exunit template
(ConnCase) is usually 700ms vs 60ms whichever comes second.
(48-core Threadripper, but similar results on macs AFAIU).
This makes --trace / --slowest flags produce misleading results.

h/t @zoldar
2025-08-27 05:42:49 +00:00
Adam Rutkowski 88cf2ac9ae
Remove redundant options merge (#5665) 2025-08-26 10:35:31 +00:00
Adrian Gruntkowski 0c9d42daf3
Handle team policy update on empty default struct gracefully (#5671)
* Reproduce policy update error

* Fix `update_policy` and `force_sso` to handle default empty value gracefully
2025-08-26 09:49:55 +00:00
Adam Rutkowski a5a71f7828
CRM: Expose 2FA user status & allow CS to force disable it (#5670)
* CRM: Expose 2FA user status & allow CS to force disable it

* !fixup
2025-08-26 08:01:24 +00:00