Commit Graph

2474 Commits

Author SHA1 Message Date
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 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
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
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
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
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
RobertJoonas 3b4342112f
show messages while waiting for detection (#5667) 2025-08-27 11:58:17 +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 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
Karl-Aksel Puulmann 619a9ed57b
ScriptV2: Use async instead of defer, new snippet (#5655)
* async -> defer

* Run legacy tests using async instead of defer
2025-08-25 07:12:11 +00:00
RobertJoonas 5b1925e6bb
Fix bug with pageview queries stacking after verification retries (#5663)
* add dev ability to quick delete sites

* fix pageview queries stacking up after failed verification
2025-08-25 05:44:29 +00:00
Karl-Aksel Puulmann b36a92fb45
ScriptV2: snippet structure change (#5662)
* Remove dead code

* Use a new snippet style

* Allow plausible to be on window
2025-08-25 05:35:06 +00:00
Karl-Aksel Puulmann bcf8b422e1
ScriptV2: Domain change refinement (#5657)
* Improve "back to settings" button

* Dark mode support for change domain

* Purge CDN cache on domain change

* Allow npm installation_type

* Detect npm installation type in detector

* Support npm installation type in onboarding

* Show warning in change domain flow for npm

* Make CE tests happy

* Cleanup

* npm_likely -> npm

* Cleanup
2025-08-21 09:25:39 +00:00
Karl-Aksel Puulmann d5ee36d47f
ScriptV2: Show warning when using Legacy GTM template, update links (#5660)
* Show warning when using Legacy GTM template, update links

* Update phrasing
2025-08-21 08:42:08 +00:00
Adam Rutkowski 43b52d599b
Group Mint.TransportError in Sentry (#5659) 2025-08-20 08:40:17 +00:00
Adam Rutkowski 3a720b5d60
Keep google auth deletions idempotent (#5656) 2025-08-20 08:11:02 +00:00
Adam Rutkowski ac739da694
Mute automated login attempts (#5658) 2025-08-20 07:52:50 +00:00
Karl-Aksel Puulmann cf423dbf99
ScriptV2: TrackerScriptCache on ee (#5648)
* Leverage TrackerScriptCache on ee

On ee, TrackerScriptCache only stores valid ids. This is then leveraged
to do no database queries when looking up tracker scripts for
non-existing ids.

For smoother onboarding purposes, refresh frequency for the script is also
reduced.

Note that the cache layout is not optimal (storing 'true' booleans) but
being more optimal would require changing the underlying cache
implementation significantly.

I tested out the cache - with 1M tracker script configs, it seems to be
~12MB in size.

* Wait on cache

* Add telemetry

* Remove cleverness in trying to reuse code
2025-08-19 11:41:19 +00:00
Karl-Aksel Puulmann 077adb99ba
ScriptV2: GTM, NPM instructions, darkmode (#5650)
* Basic NPM instructions

* Basic GTM template instructions

* Make tabs height consistent

* Tweak npm to be more in line with wordpress instructions

* Keep old link

* Attr

* Darkmode for tabs

* Make tag manager input not resizable

* darkmode icons

* Phrasing
2025-08-19 11:38:29 +00:00
Artur Pata 276f95cda2
Script v2: Make detection take less time (#5635)
* Add fast failing dns check to verification

* Convert Detection to a checks pipeline

* Convert detection to checks pipeline

* Unify browserless checks, set retry policy, timeouts

* Fix spelling

* Update change domain v2

* Fix issue with handling errors with detection

* Include timeoutMs in detector function args

* Allow saving npm installation type (#5639)

* small code style/comment improvements

---------

Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
2025-08-19 10:16:27 +00:00
Adam Rutkowski bb1db557a3
Set `timeout: :infinity` on streaming export (#5654) 2025-08-19 09:51:33 +00:00
RobertJoonas 17675af4d0
Clean up old upgrade page (dead code) (#5652)
* remove deprecated modules/fns

* get rid of starter_tier flag

* remove legacy? arg from plans
2025-08-19 09:12:48 +00:00
Adam Rutkowski e3bef74cde
Preserve query params for authenticated shared links (#5640) 2025-08-18 13:44:34 +00:00
Karl-Aksel Puulmann 6a6a195812
CE-friendly tracker_url support (#5643) 2025-08-18 09:02:08 +00:00
Adam Rutkowski 1d135d4a74
Exclude pages already added in page shields suggestions (#5637) 2025-08-13 10:02:49 +00:00
Uku Taht a32e9ee53d
Change domain 2-step flow (#5630)
* Make change-domain-v2 a two-step process

* Cleanup

* Make change domain a 2-step process

* Refactor installationv2 tests to use render_async

* Increase timeout in render_async

* Refactor to please credo

* Also increase timeout for render_async in installationv2 tests
2025-08-13 09:50:16 +00:00
Adam Rutkowski b786fba147
Include "Direct / None" in source filter suggestions (#5636)
* Include "Direct / None" in source filter suggestions

* Refactor
2025-08-13 08:52:39 +00:00
Adam Rutkowski c0abbe6432
Only display "Invoices" on sidebar when subscription is present (#5634)
* Only display "Invoices" on sidebar when subscription is present

* Add a note per @macobo's request

Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>

---------

Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
2025-08-13 08:50:43 +00:00
Artur Pata 4b0fa1f1af
Remove fallbacks for /js/s-... urls (#5629) 2025-08-13 05:41:47 +00:00
Artur Pata a2df9a986c
Script v2: Add more diagnostics cases to verifier v2, more tests for verifier v2 (#5620)
* Add more diagnostics cases to verifier v2, more tests for verifier v2

* Remove extraneous text from CSP in tests
2025-08-11 10:43:59 +00:00
Artur Pata 70eb552132
Script v2: Include prefix "pa-" in tracker_script_config.id (#5621)
* Refactor tracker config IDs to contain prefix 'pa-' in the DB

* Test

* Add NanoidBase behaviour

* Refactor to case

* Verify that only the ID changes

* Fix broken if block, add test
2025-08-11 09:44:24 +00:00
Artur Pata 5807878a18
Script v2: Handle verifying sites where there's an immediate JS redirect (#5619)
* Handle canceled execution context when verifying v2 installs

* Show diagnostics even on verification success for superadmins

* Add check for scriptv2 user to support branching off to v2 site verification better
2025-08-07 07:51:22 +00:00
Uku Taht a30375b4f4
Add HTML comment to v2 snippet (#5617)
* Add HTML comment to v2 snippet

* Make comment branded
2025-08-07 07:48:43 +00:00
Uku Taht e52bbb5bb9
Create 404 goal always in onboarding (#5618) 2025-08-07 07:48:10 +00:00
Artur Pata e8ef3f83d0
Script v2: Allow changing tracker config over Sites API site endpoints (#5607)
* Support getting and setting tracker_script_config with Sites API POST/PUT/GET site endpoints

* Fix singular with

* refactor

* Fix conditionally used function

* Format

* Fix regression with should_purge_cache?

* Check feature flag

* Add user to scriptv2 flag checks
2025-08-07 06:49:54 +00:00
Adam Rutkowski ce428cda08
CRM: split into dedicated live views with per-tab components (#5611)
* Add reusable customer support components

Extract search, layout and search result components to enable
reuse across different customer support views.

* Add dedicated Team live view with modular components

Replace inline team details with dedicated live view that includes
separate components for overview, billing, members, audit, sites and SSO
functionality.

* Add dedicated User live view with components

Replace inline user details with dedicated live view including
overview and API keys components.

* Add dedicated Site live view with components

Replace inline site details with dedicated live view including
overview, people and rescue zone components.

* Add base live view helper for customer support

* Remove old monolithic live view files

Remove shared.ex, site.ex, team.ex and user.ex from the live/ directory
as they are replaced by dedicated live views.

* Update routing for dedicated customer support live views

Add specific routes for teams, users and sites instead of generic
resource routing pattern.

* Refactor main customer support live view to use components

Simplify the main live view to act as a router, using shared search
and layout components instead of handling all resource types inline.

* Update customer support resource modules

Adjust resource modules to work with the new dedicated live view
layout instead of inline rendering.

* Update HelpScout integration and endpoint configuration

Adjust HelpScout module and endpoint settings to support the
new customer support interface layout.

* Update customer support tests for new module layout

Adjust tests to work with dedicated live views instead of
inline resource rendering.

* Format

* Clean up URI building & module headers

* Test site deletion

* Test user deletions

* Test team deletions

* Include "Go back" links in the common layout

* Remove debugging artifact 😅

* Remove old route remnant

* Remove unused code - there was an attempt

* Remove cruft as per @zoldar's comments

* Fix moduledoc

* Abstract away flashes/redirect messages sending

* Format

* Simplify CRM resource commons

* Update moduledoc

* Clean up remaining raw URIs in favour of route helpers

* Revert header.html.heex change to stop complaints on MIX_ENV=ce_dev

* Update test to work with both CE/EE

* Prevent test m/f unavailable errors on ce build
2025-08-06 15:49:51 +00:00
Uku Taht a921d7a0d1
Refactor installation screen (#5614) 2025-08-06 10:10:27 +00:00
Uku Taht 00f24bfcd6
Use new Detection module in installation screen (#5604)
* Use new Detection module in installationv2

* Update tests

* Simplify mount function
2025-08-04 13:42:51 +00:00
Artur Pata bb17a17e5a
Script v2: Allow verifying that tracker installed correctly (1st iteration) (#5572)
* Sketch out verification for v2 installs

* WIP

* Fix naming

* Implement CSP check, refactor what test event output looks like

* Update error matcher

* Better typedefs

* Unify error format

* WIP diagnostics

* Delete superfluos doc

* Remove prettierrc

* Fix type

* Remove superfluous error file

* Remove foobar.md

* Fix format and variable names, ensure compliance for errors

* Add cache bust check, fix success diagnostics

* Fix v2 verifier spec and add moduledocs

* Make test not dependent on tracker script version

* Make verifier less CPU intensive

* Change the signature of checkDisallowedByCSP

* Fix unused service_errror matcher

* Refactor data_domain to expected_domain

* Ignore request URL

* Add case for for succeeding after cache bust

* Fix infinite recursion

* Relax CSP error interpretation

* Fix sentry message, ignore plausible.s
2025-07-31 08:10:44 +00:00
RobertJoonas cd875eee96
new case clause for handling browserless error response (#5600) 2025-07-30 09:37:50 +00:00
Marko Saric 797a5bf4c1
clarifying the suggested plan (#5598)
* clarifying the suggested plan

* Update over_limit.html.heex

* Update dashboard_locked.html.heex

* fix tests

---------

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2025-07-29 07:33:22 +00:00
RobertJoonas bc1794cac7
Verifier v1: Retry verification on JS navigation (#5599)
* retry verification v1 on JS navigation

* review comments

* update comment
2025-07-29 07:00:37 +00:00
RobertJoonas c5adbc6af0
Detector.js - detect v1 and technologies used on the website (#5591)
* fix comment on localhost dogfood tracking

* improve detector script and integrate into Elixir

* wait for window.plausible.l instead of window.plausible

* do not touch source files during compilation

* stop referencing compiler hint module attr
2025-07-29 06:17:16 +00:00
Adam Rutkowski e7e553cf9d
Fix shifting focus to filter bar when typing / in a legit input (#5583)
* Fix shifting focus to filter bar when typing / in a legit input

* Format
2025-07-24 10:42:42 +00:00
Adam Rutkowski afbc350b8d
CRM: implement basic SSO audit browser (#5586)
* Allow storing audit entry "change" raw

* Modify audit test helpers so they return actual audit entries

* Accept optional `rows` in input textarea component

* Instrument SAML consumption with audit entries

* :nail-care: EE-only modules don't need `on_ee`

* Derive audit encoder for SSO Identity

* Implement Audit tab in CRM

* Fix typo

* Instrument domain removal with audit entries

* Preload `sso_integration` for domain removal

* Use two else clauses for SAML consume errors
2025-07-23 16:45:33 +00:00
Adrian Gruntkowski 144b58e508
Put SSO among plan features, replacing "Technical onboarding" (#5587) 2025-07-23 11:07:04 +00:00
RobertJoonas dffb698fa2
Change log level from info to notice on relevant logs (#5585)
* change log level from info to notice on relevant logs

* bump log level to notice for everything except request logger

* format

* fix choose_plan_test.exs for good (starter tier launch)
2025-07-23 08:47:01 +00:00
Adrian Gruntkowski 5d71ab9234
Implement CTA for SSO (#5582) 2025-07-22 11:31:54 +00:00
Adam Rutkowski adf39ca7a8
Audit trail for SSO (#5560)
* 

* wip

* wip

* Moduledoc false

* wip

* Update extra/lib/plausible/auth/sso/saml_config.ex

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>

* Include only data keys present in changes

* Improve audit logging for SSO domain verification

Make it more compact and hopefully more readable to CS

* Harden existing tests

* Use consistent naming

* Update audit entries migration: use UUIDs for primary keys

* Fix up tests

* Format

* Only test audit for EE

* Remove temporary String.Chars implementation

* Always log keys as per `derive` directive; include changes for inserts

* Write `actor_type` to audit entries

* Extract Audit.Repo functions

* Moduledocs

* Include change in audited deletions

* Make audit available only in EE build

A bit clunky? cc @zoldar

* Put test behind ee compilation flag

* Pin user e-mail in test

* Ensure encoder opts are passed for nested calls

* Carry `__allow_not_loaded__` even if no extractor defined

* Turn `actor_type` into an ecto enum type

* Remove unused function

* s/sso_forced/sso_force_mode_changed

* Unwrap single item list for protocol implementation

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>

* Migration: audit entries (#5581)

* Migration: audit entries

* Put migration behind EE conditional

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2025-07-22 10:53:24 +00:00
Adrian Gruntkowski 8da98fb26e
Safeguard sign-dependent metrics from negative values (#5569)
* Safeguard sign-dependent metrics from negative values

* Test graceful visits calculation for invalid sessions data
2025-07-17 12:45:14 +00:00
RobertJoonas e357569b91
Add "Managed Proxy" to the upgrade page under Enterprise benefits (#5574)
* add managed proxy to enterprise plan benefits

* silence logs from verification liveview tests too
2025-07-17 10:00:18 +00:00
Adrian Gruntkowski 832c767d91
Improve SSO naming and setup (#5558)
* Use 2FA (and not MFA) uniformly across messaging and code

* Parse PEM certificates without boundary markers (Okta)

* Update SAML configuration form labels

* Revise intro SSO copy slightly

* Upcase button label

* Make Single-Sign On casing consistent

* Fix formatting

* Implement rate limiting for SSO login endpoint

* Update docs links

* Update docs links

* Fix formatting
2025-07-17 08:52:53 +00:00
Uku Taht b7f8ed4607
Scriptv2 - change domain (#5565)
* Add a new domain change flow when scriptv2 flag is enabled

* Use liveview for change domain flow

* Move additional steps to notice, include general info about domain change

* Format

---------

Co-authored-by: Artur Pata <artur.pata@gmail.com>
2025-07-15 14:10:45 +00:00
RobertJoonas 97dcc3fe7c
Refactor Verification module structure (#5570)
* detector.js

* refactor: organize modules better

* Renaming (Elixir + JS)

* lib/plausible/verification -> lib/plausible/installation_support
* test/plausible/verification -> test/plausible/installation_support
* priv/tracker/verifier -> priv/tracker/installation_support
* tracker/verifier -> tracker/installation_support
* tracker/test/verifier -> tracker/test/installation-support

* rename remaining test modules

* add documentation

* dialyzer: remove module refs that do not exist yet

* Fix CI

* fix tracker CI

* fix tracker CI for good
2025-07-15 10:50:34 +00:00
RobertJoonas 39c006bfb9
Verification follow-up improvements (#5568)
* handle unhandled verification case

* log site domain on browserless errors

* mix format

* info -> warning to see the logs
2025-07-15 06:59:11 +00:00
RobertJoonas b76996b3a4
Verification v2 (#5549)
* new verifier script with tests + telemetry

* dataDomainMismatch tests

* more tests for callbackStatus and plausibleInstalled

* create priv/verifier subfolder + fix Elixir CI

* bump CI cache version

* organize verifier tests

* Remove accidentally committed verifier

* Rework compilation: Make it a variant, always return new verifier code in tests

* Make priv/tracker/verifier/ exist

* Handle static checks with grace

* Fix paths

* Fix paths

* Add some tests

* Add one more test

* split up the JS

* proxyLikely + code structure refactor + unit tests

* fix telemetry fields

* move most telemetry to logs

* run verifier tests only on chromium

* detect wordpressPlugin and wordpressLikely

* detect GTM

* rename JS checks

* detect cookiebot

* include new fields in logs

* different logs for browserless request vs js failures

* detect manual extension

* detect unknown attrs + fix logging

* stick to Elixir checks for snippet detection

* fix codespell

* fix IO.inspect

* remove unnecessary fields from test mock

* cookiebot doc

* move test into verifier subfolder

* do not duplicate ts types

* comma -> semicolon in log

* test dynamically loaded snippet

* improve logging on Browserless error

---------

Co-authored-by: Karl-Aksel Puulmann <oxymaccy@gmail.com>
2025-07-14 14:32:21 +00:00
Artur Pata 3bdbe83383
Script v2: Sync event.props.path for special path-based events from event.pathname (#5559)
* Sync pathname to event.props.path for special path-based goals

* Stop adding event.props.path for 'Form: Submission' events

* Update tracker script version

* Fix test expectations

* Fix format

* Simplify maybe_put_props_path with 'with'

* Add specs, fix factory

* Update tracker changelog

* Update EE/CE changelog

* Remove business logic from factory

* Refactor event.props.path sync result to be validated with the rest of the custom props

* Clarify doctests and update function name
2025-07-14 08:39:25 +00:00
Adrian Gruntkowski 359438a899
Implement ability to leave team (#5555)
* Implement ability to leave team

* Add changelog entry

* Fix button copy

* Alter "Delete my account" button label to "Delete My Account"
2025-07-09 12:41:59 +00:00
Uku Taht 1f9457992d
Add test suite for installationv2 (#5561) 2025-07-09 08:50:06 +00:00
Uku Taht 5a7b61a251
Fix installation_v2 redirect url encoding (#5557) 2025-07-08 11:48:42 +00:00
RobertJoonas de1ada93a9
increase trial team member limit to 10 (#5553) 2025-07-08 07:01:03 +00:00
Cenk Kücük 10ffd20cbb
Update ignored routes in OpenTelemetry sampler to include additional variants (#5542) 2025-07-07 11:59:51 +00:00
Artur Pata 3c6db4efeb
Sync form submissions tracking goal (#5545) 2025-07-02 08:45:56 +00:00
Uku Taht 29b5e9fa59
Scriptv2 onboarding: Recommend installation type (#5534)
* Determine installation type in installation screen

* Show spinner while installation type is being determined

* detected_installation_type -> recommended_installation_type

* Display recommended type on first load
2025-07-02 08:43:28 +00:00
Adrian Gruntkowski fc24db4281
Exclude Owner from default SSO roles and improve PEM certificate validation (#5540)
* Do not allow setting Owner as default SSO role

* Make PEM certificate validation more robust
2025-06-30 13:33:59 +00:00
Adam Rutkowski ce1bd2d4c4
CRM: allow forceful SSO domain deprovisioning + integration removal (#5539)
* CRM: allow forceful SSO domain deprovisioning + integration removal

* Refresh members whenever the tab contents might change

* Use live redirect when removing integration
2025-06-30 13:02:37 +00:00
Adam Rutkowski 528693889d
CRM: add ability to deprovision individual users (#5537)
* CRM: add ability to deprovision individual users

* Use existing user fetching interface

* Remove unused table column

* Deprovision with proper refresh afterwards
2025-06-30 08:40:17 +00:00
Karl-Aksel Puulmann dd812f48ba
ScriptV2: Remove hashBasedRouting from server-interpolated config (#5532)
New onboarding _does not_ have a checkbox for hash based routing, so remove it from server-interpolated config
2025-06-26 10:01:25 +00:00
Adrian Gruntkowski 39656f782c
Implement listing and revoking of SSO sessions from team settings (#5529)
* Refactor and unify logic for account and site settings sidebars

* Implement listing and revoking of SSO sessions from team settings
2025-06-26 08:48:25 +00:00
RobertJoonas 6369d0efad
Dogfood script v2 (#5504)
* dogfood with script v2 + disable tracking in tests

* remove endpoint override

* disable dogfood tracking on localhost

* track pageviews from details views and filter modals
2025-06-25 10:56:02 +00:00
Adrian Gruntkowski 7490828e71
Implement automatic re-login on SSO session expiration (#5525)
* Implement automatic re-login on SSO session expiration

* Adjust allowed range of `sso_session_timeout_minutes` in team policy

* Test autosubmit rendering

* Test `UserSessions.get_by_token/1`

* Test expired session case for `AuthPlug`

* Test `UserAuth.get_user_session` case for expired session

* Test `HandleExpiredSession` plug
2025-06-25 09:41:47 +00:00
Adam Rutkowski ef11425693
Calmer multiple teams experience (#5526)
* Offer team switcher on /sites if applicable

- in case of empty My Personal Sites view, and with
  another team with sites being available
- redirect straight to first team upon invoking team
  switcher, if there's only one available
- redirect to /sites from team switcher, if there
  are no set-up teams available

* Remove unused test helper

* Store and use last team identifier

* Remove alert about starting trial when adding first site

* Format

* Update lib/plausible_web/live/sites.ex

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2025-06-24 16:11:27 +00:00
Adrian Gruntkowski cf34850a13
Add "SSO" billing plan feature and hide SSO setup behind it (#5524)
* Add SSO plan feature

* Gate SSO configuration with plan feature

* Don't preselect SSO feature when creating new custom plan
2025-06-24 11:51:32 +00:00
Adrian Gruntkowski 307d6b004b
Implement plug for checking SSO team access (#5522)
* Implement plug for checking SSO team access

* Add the new plug to the `browser` pipeline and adjust routes

* Don't log in on failed provisioning and display issue notice instead

* Require user to be provisioned as SSO before toggling "Force SSO"

* Label SSO members explicitly in team management LV

* Make slight layout and copy adjustments in provision issue view

* Improve copy (h/t @aerosol)
2025-06-24 08:25:24 +00:00
Adam Rutkowski 3c032f84c3
Minor improvements to Team management UI (#5523)
* Team members setup: indicate disabled with color

* Bugfix: grey-out guest role picker if insufficient permissions.

This wasn't any critical though, the UI would act janky but
permissions were enforced anyway on change.
2025-06-24 08:18:20 +00:00
Adam Rutkowski e56baeb272
Persist login type preference (SSO/standard) (#5520)
* First pass: store login preference

* Only set login preference if SSO is used

* Change mock DNS to use port 5354 and `domain_id` for parameter

* Make login forms use flash message for error passing

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2025-06-23 10:28:27 +00:00
Adrian Gruntkowski a2ed1e04b1
Revise system behaviour for SSO users (#5506)
* Setup MFA properly in SSO tests

* Move `new_identity` test helper to common helpers

* Make standard login only allow Owner SSO users

* Implement `Plausible.Users.type/1` for determining user type

* Implement plug restricting action based on user type

* Restrict or adjust access to settings actions to SSO users

* Make a very small refactor to `Auth.SSO` helper

* Prevent SSO users from acceptig team invitations

* Prevent SSO users from adding websites under "My Presonal Sites"

* Prevent implicit team creation by SSO users

* Add workaround for compiler warning under CE

* Remove SSO user on removing membership

* Prevent changing role to owner when 2FA not enabled

* Prevent provisioning from standard user with active personal team

* Fix `Auth.lookup/1` to not break for standard users on multiple teams

* Use `Plausible.always/1` (h/t @aerosol)

* Revert "Use `Plausible.always/1` (h/t @aerosol)"

This reverts commit 0ee7dd84d3.

* Rename `RestrictType` -> `RestrictUserType`

* Make the configuration intent more explicit in `RestrictUserType` plug

* Rename plug file
2025-06-23 08:19:12 +00:00
Karl-Aksel Puulmann 6ade93bf86
ScriptV2: Self hosted tracker script cache (#5502)
* Allow caching tracker script on CE

Open questions with this approach:
- `ingestion_url`: Using `PlausibleWeb.Endpoint.url()` requires that endpoint has started, but we
  want to pre-warm the cache _before_ the endpoint starts. To work around this, a different approach
  is used to get the right url.
- caching: Other caches currently cache database models, this caches a string. Will this cause issues?

* Slightly better workaround

* Lazier timers
2025-06-20 06:59:18 +00:00
Adam Rutkowski 4387d42409
CRM: First pass SSO support (#5517)
* CRM: First pass SSO support

* Put `sso_integration` association behind `ee` check
2025-06-19 11:52:15 +00:00
Uku Taht 973b626625
Onboarding review flow (#5491)
* Scriptv2 onboarding: review flow

* Make sure bundled features are enabled by default in v2 onboarding

* Call get_or_create correctly

* Refactor custom plan form to use boolean-based checkboxes
2025-06-19 11:34:41 +00:00
Adam Rutkowski 70902bbc5a
SSO: phrasing; settle on domain verification, not validation (#5508)
* SSO domains: s/validation/verification

* Fix careless search&replaces
2025-06-16 18:44:57 +00:00
Adam Rutkowski 1c182d6980
Set a long salts refresh interval on Mix.env == :test (#5510) 2025-06-16 14:50:01 +00:00
Adam Rutkowski b86e4eea7e
SSO: implement domain validation background service (#5505)
* SSO: implement domain validation background service

* Put tests behind `ee`

* Fix up typespecs
2025-06-16 11:56:59 +00:00
Karl-Aksel Puulmann c7779e2f33
ScriptV2: Support `meta` only in legacy scripts (#5492)
* Revert "Log warning when m/meta parameter used in ingestion (#5478)"

This reverts commit d4bec6d9e3.

* Support `meta` argument only on legacy scripts + test

* Changelog

* Bump version
2025-06-16 12:25:00 +03:00
Adam Rutkowski dad00d26c2
Periodically refresh salts so that non-rotating nodes catch up (#5496)
* Periodically refresh salts so that non-rotating nodes catch up

* Remove Logger ref 0a2ed563dd & facf743670

* typo
2025-06-16 05:23:46 +00:00
Karl-Aksel Puulmann d215e50982
ScriptV2: Rework WordPress plugin token adding flow (#5493)
* Remove dead code

* Rework plugin API token flow

* Changelog

* Redundant code

* Remove onfocus
2025-06-12 08:18:58 +00:00
RobertJoonas d00dde183e
Starter Tier: Getting ready for release (#5489)
* make starter tier flag team based not user

* old upgrade page for active or recently ended trials

* adjustments to plan benefits

* mention losing grandfathering when on v4

* extract plan benefits into separate module

* unit tests for plan benefits + fix enterprise site/team_member benefits

* hide Starter tier from grandfathered Growth

Also get rid of the grandfathered notice in Growth plan box

* choose_plan_test.exs to ee_only

* fix ci

* actually fix ci

* stop displaying new starter features for grandfathered teams

* bump starter tier launch date

* Revert "stop displaying new starter features for grandfathered teams"

This reverts commit e024a82d14.
2025-06-11 12:48:22 +00:00
Adrian Gruntkowski 153702c20f
Implement SSO setup UI (#5473)
* Extend core APIs for better insight into SSO state during setup

* Adjust `toggle_switch` compoenent to accept global attributes

* Improve textarea variant of input component

* Make first very crude pass on SSO setup UI

* Display "Single Sign-On" settings option only when enabled

* Extract SP identity ID function to SAMLConfig as a public one

* Move SAML controller logic behind an adapter

* Don't apply CSRF protection to SAML consume endpoint

* Make copy adjustments

* Change SSO sidebar icon

* Fix `fake_domain_verify` handling before integration is set up

* Tweak configuration markup

* Sanitize PEM input

* Tweak SSO settings sections + prevent domain deletion if applicable

* Minor tweaks to SSO settings tiles

* Bootstrap basic test suite

* Ensure SSO settings are guarded by env var

* Make sure to retry fake domain validation on integration-less cycle

* Trim idp entity id input

* Dedup assertions

* Fix domain identifier interpolation

* Tidy up integration fetching

* Expand tests for SSOManagement LV with fixes

---------

Co-authored-by: Adam Rutkowski <hq@mtod.org>
2025-06-11 10:52:20 +00:00
Karl-Aksel Puulmann d4bec6d9e3
Log warning when m/meta parameter used in ingestion (#5478)
* Log warning when m/meta parameter used in ingestion

This parameter was added in October 2020 and then renamed 2 days later: 40900c7653 and 0b6e645b44

We are hoping we may be able to remove it which this logging will help with.

* Log only domain
2025-06-10 08:01:25 +00:00
RobertJoonas 4e5093f86c
Starter Tier: Shared Link Feature Gates (#5474)
* feature gate creating shared links

* feature gate GET shared_link

* stop granting shared links access in code + organize tests

* allow GET shared_link for WP

* prevent shared link creation with special name

unless created by the Plugins API, the name WordPress - Shared Dashboard
will be considered reserved.

* do not render special shared links in site settings > visibility

* remove hardcoded special name from test

* add function doc for special names

* prevent updates to special name as well

* warn about losing access to shared links

* make features_usage return empty list on ce

* Update lib/plausible/sites.ex

Co-authored-by: hq1 <hq@mtod.org>

* move special name check to changeset

* fix tests

---------

Co-authored-by: hq1 <hq@mtod.org>
2025-06-10 06:43:40 +00:00
hq1 efc55e323d
Remove kaffy (#5423)
* Deal with `FeatruesList` proxy

* Remove kaffy: first pass

* Remove admin controller

* Remove kaffy: last batch

* unlock dependency

* Remove kaffy links

* !fixup
2025-06-10 06:24:47 +00:00
hq1 bdc44d1d33
CRM: Refund lock (#5480)
* Redefine what `on_trial?` means

No subscription combined with
non-zero trial_days_left designates an ongoing trial.
Conversely, any subscription in any state means
the trial is inactive.

* Fix cancellation notices

We now show the cancellation warning
when the subscription is about to expire.

* Implement the ability to lock cancelled subscriptions

in case a refund is made

* Dedup notice body

* Spawn confirmation alert before locking
2025-06-09 13:53:40 +00:00
Karl-Aksel Puulmann 84d8e60e92
Drop installation_meta mentions from schema (#5479)
Nothing is reading or writing this anymore. We can this way (hopefully) eventually drop the column as well.
2025-06-09 09:39:39 +00:00
hq1 df8727f414
CRM: revert #5440; implement lock/unlock for grace period (#5475)
* Revert "CRM: team (un)lock regardless of grace period (#5440)"

This reverts commit bb63c0d0e4.

* Implement grace period (un)lock just like in kaffy

* Test grace period handling
2025-06-06 08:01:29 +00:00
ruslandoga 0a2ed563dd
more salts logging (#5471)
* more salts logging

* even more logs

* wording
2025-06-04 11:13:29 +00:00
Marko Saric f36c0ee642
Slight change to the plugin token copy (#5468)
* Update token_form.ex

* Update token_form.ex

* Format

---------

Co-authored-by: Adam Rutkowski <hq@mtod.org>
2025-06-04 09:29:42 +00:00
Adrian Gruntkowski 0968ed7f2c
Implement `SSO.Domains.remove/1,2` and `SSO.Domains.check_can_remove/1` (#5461)
* Implement `SSO.Domains.remove/1,2` and `SSO.Domains.check_can_remove/1`

* Add `sso_domain` relation to `Auth.User` schema

* Populate `user.sso_domain` on provisioning and validate identity domain

* Simplify lookup by domain in `SSO.Domains.remove/1,2`

* Extend tests

* Derive user name from email in fake SAML controller

* Fix formatting
2025-06-04 08:56:50 +00:00
RobertJoonas 38f1de6ecd
Starter Tier: Teams UI follow-ups (#5456)
* keep teams feature explicitly for UI

* keep devsubscriptions in sync with prod

On prod, when a subscription is created without a current team in assings,
a new team is force created for that user.

* disable team creation when no point to create it

* fix ce_test compile warning

* fix tests on CE

* Update lib/plausible/teams/billing.ex

Co-authored-by: hq1 <hq@mtod.org>

* add solo team in seeds

* fix top border blur + stop autofocusing input when blurred

---------

Co-authored-by: hq1 <hq@mtod.org>
2025-06-03 10:14:50 +00:00
Karl-Aksel Puulmann 692fd30a3e
Add telemetry to tracker script generation (#5437)
This will be used to measure rollout success and load after purges
2025-06-03 07:11:47 +00:00
Adrian Gruntkowski 4a587e2a6e
Implement remaining `SSO` functions needed for setup (#5444)
* Move data mgmt logic from `UserAuth` to `Auth.UserSessions`

* Implement remaining SSO code API needed for setup

* Change `deprovision_user` -> `deprovision_user!`

* Change `UserSessions.create` -> `UserSessions.create!`

* Change `any_verified_domain?` -> `no_verified_domains?` (h/t @aerosol)
2025-06-03 06:21:51 +00:00
hq1 f86ef2a4c1
Add phx-submit to filter bars (#5455) 2025-06-02 13:20:31 +00:00
Adrian Gruntkowski bca78169bb
Implement SSO login against fake SAML endpoints (#5434)
* Add SSO user as a team member on provisioning

* Implement fake SSO actions and basic login form

* Handle team member limit error and adjust login redirect in `UserAuth`

* Always switch to related SSO team on SSO user login

* Ensure `timeout_at` is set when creating new standard user session

* Add env var flag for gating SSO

* Hide SSO login link when SSO disabled

* Hide SSO routes when SSO disabled

* Implement nonce-based allowance for js in SSO content security policy

* Test controller actions

* Add more tests for UserAuth

* Add sync tests for `GateSSO` plug and env var flag in disabled state

* Add test for SSO owner logging in via standard login
2025-06-02 12:13:56 +00:00
Marko Saric bd2e32586e
Small changes to the teams copy (#5450)
* Update _header.html.heex

* Update notice.ex
2025-06-02 12:07:37 +00:00
Artur Pata 027952e339
Does not include tracking script on /cs module (#5452) 2025-06-02 11:44:42 +00:00
Adrian Gruntkowski 9ec7864f44
Ensure team locked state is updated on site creation and removal (#5451)
* Ensure team locked state is updated on site creation and removal

* Do not lock team when there are no sites

* Ensure SiteLocker is only run on EE

* Get rid of troublesome alias
2025-06-02 10:45:20 +00:00
Uku Taht 9a7cb6cc26
Update tracker config in scriptv2 onboarding (#5443)
* Update tracker config in scriptv2 onboarding

* Use actual scriptv2 installation script

* Unwrap result from transaction

* Only run cache purge tests on ee
2025-06-02 10:39:31 +00:00
RobertJoonas adfcd0f584
for now allow teams and shared links for everyone (#5446) 2025-05-30 16:45:57 +00:00
RobertJoonas e38bda6d00
Starter feature gates (UI) (#5426)
* replace yellow warning notice with more inviting cta (funnels)

* align VAT notice with /year on the upgrade page

* improve tooltip component

do not hide the tooltip when the mouse enters the tooltip itself directly
from the trigger element. This allows clicking links in tooltips.

* improve site segments feature gate UI

Disable the save button when site segment option is selected in create or
edit form. Also render a different upgrade notice if the user is not the owner.

* replace upgrade notices with blur UI

To fully get rid of Notice.premium_feature, we will also display a
"not allowed" cursor with tooltips asking to upgrade where necessary.

* extract toggle switch component

* Hide currency toggle from goal edit form

The currency field cannot be changed for an existing goal anyway. Therefore
it makes sense not to show it at all. This commit makes the currency picker
always visible when editing a revenue goal, and always hidden for custom
event edit form.

* simplify api key creation form

Turn "Sites API access" into a toggle switch identical to "Enable revenue
tracking" in goal creation form.

* remove team setup CTAs for Starter tier

* fix team member limit for starter

* adjust v5 plan limits and limit exceeded notices

* do not display global notices on upgrade-success page

* fix settings/subscription monthly quota boxes alignment

* fix CI

* use tailwind backdrop-blur

* remove dangling log + avoid passing setSaveDisabled

* remove duplicate function clauses revenue goals

* revert create api key UI change but disable button still

* optimize for darkmode

* blur team settings > team members for Starter

* rename team accounts to team management
2025-05-30 13:34:19 +00:00
Marko Saric 0a3e7dab5e
Update team_setup.ex (#5445) 2025-05-29 15:44:33 +00:00
hq1 bb63c0d0e4
CRM: team (un)lock regardless of grace period (#5440)
* Add `locked_by_admin` to teams schema

* Implement team locking

* Look up `teams.locked_by_admin` in relevant background services

* Add background servive tests

* Type faster than think!
2025-05-28 11:28:59 +00:00
ruslandoga facf743670
log salt hashes with warnings (#5441) 2025-05-28 11:19:10 +00:00
Karl-Aksel Puulmann 6a06020ba7
ScriptV2: BunnyCDN cache purging (#5435)
* Purge bunny cdn cache when tracker script config is updated

* Only allow one purge task scheduled per site

Tested by adding logging and toggling a checkbox a few times. Only one job got executed.

* Typo
2025-05-28 10:08:33 +00:00
Adrian Gruntkowski b341f2735a
Always expire SSO User sessions after `identity.expires_at` (#5429)
* Always expire SSO User sessions after `identity.expires_at`

* Refactor

Co-authored-by: hq1 <hq@mtod.org>

---------

Co-authored-by: hq1 <hq@mtod.org>
2025-05-28 06:59:39 +00:00
Karl-Aksel Puulmann 98cdeb23dd
ScriptV2: Configuration renames, iteration (#5427)
* plausible-main -> plausible-web

* Change elixir workflow

* Update tracker option names in tracker.ex

* config.hash -> config.hashBasedRouting

* Enable revenue by default for plausible-web

* Enable taggedEvents by default

* config.local -> config.captureOnLocalhost

* manual -> autoCapturePageviews

* Update playwright tests

* Support adding/editing file types for download in plausible-web

Original docs: https://plausible.io/docs/file-downloads-tracking#what-if-i-want-to-track-a-different-file-type

* rebase: initialize-page-dynamically update

* chore: Bump tracker_script_version to 12

* Ignore pageviews in file-downloads.spec

* Phrasing in tests

* Remove unneeded conditional
2025-05-27 11:28:17 +00:00
Uku Taht 5f33f836fb
Add tabs for installation types (#5425) 2025-05-27 10:33:21 +00:00
Adrian Gruntkowski 4ffdfe3f69
Implement `SSO.provision_user/1` and extend `UserAuth.log_in_user/3` (#5424)
* Add `SSO.Identity` struct

* Ensure timestamps are set to second resolution to avoid issues

* Implement `SSO.provision_user/1`

* Implement `UserAuth.log_in_user/3` clause accepting identity

* Fix type declaration in `UserAuth`
2025-05-27 07:55:23 +00:00
Karl-Aksel Puulmann b5bd623cf1
tracker_script_configuration: plugins API (step 5) (#5410)
* Plugins API for tracker script configuration

* no support for track_404_pages in plugins api

* Update lib/plausible_web/plugins/api/controllers/tracker_script_configuration.ex

Co-authored-by: Uku Taht <Uku.taht@gmail.com>

* Restructure update code

* Remove dead code

---------

Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2025-05-27 06:05:27 +00:00
Karl-Aksel Puulmann 8bbb4408da
tracker_script_configuration: drop writes and reads to `installation_meta` (step 4) (#5409)
* Read and write only new schema

* add cdn_tag header

* Remove default thats not needed
2025-05-27 05:36:36 +00:00
Karl-Aksel Puulmann 93dfb21669
tracker_script_configuration: backfill (step 3) (#5408)
* tracker_script_configuration table migration

* tracker_script_configuration schema + upsert tests

* TrackerScriptConfiguration: read from installation_meta, double-write, refactor installation flow to work off of new model

* Fix a test

* Backfill tracker script configuration
2025-05-26 12:31:22 +00:00
Karl-Aksel Puulmann b972817782
tracker_script_configuration: schema, double-writes (step 2) (#5407)
* tracker_script_configuration table migration

* tracker_script_configuration schema + upsert tests

* TrackerScriptConfiguration: read from installation_meta, double-write, refactor installation flow to work off of new model

* Fix a test
2025-05-26 11:50:22 +00:00
hq1 27933d0045
CRM: Expose site transfer (#5418)
* Expose rescue zone/site transfer in CS

* Add notes

* Clean up
2025-05-22 07:47:22 +00:00
Adrian Gruntkowski 9de15326dc
Introduce migration and schemas for SSO (#5411)
* Add polymorphic_embed library

* Add formatter rules for polymorphic_embed

* Add new and extend existing schemas for SSO
2025-05-21 09:53:12 +00:00
Marko Saric fcb704fa24
Adjust note about no invoices (#5412)
* Note about no invoices

* Adjust tests

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2025-05-21 09:20:09 +00:00