3357 Commits

Author SHA1 Message Date
10188b7067 Try to resolve segments in the front-end 2025-03-11 14:13:17 +02:00
f00741f5da Refactor ListReport to TS, share props 2025-03-07 17:14:52 +02:00
2db60c90af Provide top stats graphable metrics from BE (#5160)
* Provide top stats graphable metrics from BE

* Update changelog
2025-03-07 12:08:25 +00:00
a6a103a9a0 Update button positions (#5157) 2025-03-07 10:00:10 +00:00
964ca85f68 Fix issue with shared link auth with /current-visitors and segments requests (#5154)
* Remove Segments API feature gate since flag is globally true

* Include auth param with all requests when on shared dashboard

* Update changelog

* Remove feature flag check plug

* Unify logic, refactor names

* Refactor name
2025-03-06 15:35:56 +00:00
hq1
aa91289153 Team provisioning tweaks (#5155)
* Remove "team layout updated" flash message

* Remove flash when switching team

* Prevent illegal UI states when at team members limit already

* Test UI states at team members limit

* Remove unnecessary socket assign
2025-03-06 12:52:44 +00:00
694bd6fae2 Improve dashboard main graph - revenue metrics, nulls (#5153)
* Main graph: Graph revenue metrics as zeroes instead of nils.

This has no effect on existing APIs as:
- Comparisons/empty data point logic only affects APIv1 which does not expose revenue metrics

Also changes semantics for visit_duration to be more in-line with the
rest.

* Improve dashboard main graph

- Graph tooltip for revenue metrics now shows revenue with the relevant
  monetary unit.
- Graph tooltips for scroll depth, visit duration and so on now shows `-`
  instead of 0 on dates where no relevant visits occurred.

* Remove business logic duplication
2025-03-06 12:11:01 +00:00
351e7c9100 Bump elixir.yml cache version to fix a test (#5143)
A test in test/plausible_web/plugs/tracker_test.exs was failing due to
cached version of tracker script being used in other PRs.

The reason it didn't fail in the original PR adding the test was that
changes in tracker script bypassed the cache **for that pr**.
2025-03-06 10:30:21 +00:00
hq1
b7912c665e Expose teams.notes in CRM/HelpScout (#5151)
* Expose teams.notes in CRM

* Expose team notes via HelpScout notes

* Fix dialyzer
2025-03-06 10:10:27 +00:00
hq1
eaeec7ae5f Exports revert (#5152)
* Revert "Ensure no export button is rendered for public roles"

This reverts commit 213fafe041af79500e9dff67c09b65b4b08fd68d.

* Revert "Restrict public CSV export access (#5089)"

This reverts commit d3d054748488ec3b654b07ec3c1014bdd1aecc36.

* Keep the Role.public enum needed elsewhere
2025-03-06 09:58:03 +00:00
1ba8eaa11f Show Saved Segments in changelog (#5147) 2025-03-06 09:58:00 +00:00
0f62ad0e98 Reveal segment filters in v2 Stats API (#5145)
* Reveal segment filters in v2 Stats API, update changelog

* Indicate that otherwise internal filter resolves when it is part of a segment

* Update segment related query parser tests

* Separate PR for changelog
2025-03-06 09:18:46 +00:00
hq1
3f3131d67c Migration: add notes to Teams (#5150) 2025-03-06 09:17:03 +00:00
69d74e76e5 Add site_segments feature to enterprise plans (#5149) 2025-03-06 08:33:59 +00:00
c85862e9ed Access document more defensively (#5148)
* Access document more defensively

* Add test
2025-03-05 16:06:06 +00:00
75e46bf54b Prepare FE feature flag for launching smoothly (#5146)
* Prepare FE feature flag for launching smoothly

* Enable choose_plan visuals on saved_segments_fe as well
2025-03-05 12:24:54 +00:00
hq1
2eef3d9969 Use compile-time Ingestion.Source lookups (#5141)
* Use Source compile-time source lookups

* skip a test
2025-03-05 09:18:45 +00:00
294f6da293 Scroll Depth Release: make pageleave script the new default (#5105) (#5137)
* pageleave to default

* update report-sizes.js

Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2025-03-04 12:35:24 +00:00
54f20388c6 Stop cache merge test from failing (#5135)
Some checks failed
Build Private Images GHCR / build (push) Has been cancelled
Check spelling / codespell (push) Has been cancelled
Elixir CI / Build and test (ce_test, postgres:16) (push) Has been cancelled
Elixir CI / Build and test (test, postgres:15) (push) Has been cancelled
Elixir CI / Static checks (format, credo, dialyzer) (push) Has been cancelled
NPM CI / Build and test (push) Has been cancelled
Publish Elixir documentation / build (push) Has been cancelled
2025-03-04 10:47:11 +00:00
47b8553ca1 Implement Site Segments billing feature (#5129)
* Implement Site Segments billing feature

* Make sure Site Segments benefit appears only when feature flag is present

* Add site_segments flag to v3 plans

* Refactor new filter menu back to ghost button

* Stop error state from persisting (#5131)

* Refactor how Segments appear on Choose Plan page

* Limit to 500 segments per site
2025-03-04 10:09:40 +00:00
8926f6d6c1 peep (#5130)
* peep

* adapt peep to prom_ex buckets

* handle overmax
2025-02-28 13:15:05 +00:00
hq1
9e5be7103a Revert "peep (#5126)" (#5128)
This reverts commit 90d0581c9919daa481d56b0627cca6dfb20431e7.
2025-02-28 08:00:48 +00:00
5ae2fd89f0 Resolve segment owner names and dates in site timezone in the BE (#5119)
* Resolve segment owner names and dates in site timezone in the BE

* Fix SegmentAuthorship

* Fix issue with updating dangling segment

* Refactor flaky PATCH segment test

* Unify segment type label logic

* Refactor SegmentOwnership type definitions for clarity
2025-02-28 07:06:20 +00:00
90d0581c99 peep (#5126) 2025-02-28 06:46:16 +00:00
hq1
357da7b719 Reduce n lock partitions (#5124)
* Reduce n lock partitions

Isolated operations are no longer performed.

* !fixup

* !fixup
2025-02-27 14:45:54 +00:00
hq1
749bfed91e Include observer in MIX_ENV=dev (#5122) 2025-02-27 06:46:49 +00:00
66c57daa70 use 100 sessions partitions (#5121) 2025-02-26 17:45:36 +00:00
6d3e6a76da Segments end of life (#5095)
* Deal with segments when guest member is removed

* Handle segments when user removed from team

* Deal with user deletion

* Fix spelling

* Fix postgres client make task

* Remove migration
2025-02-26 13:54:07 +00:00
e252c75164 Cascade owner deletion to segments with nilify_all (#5118) 2025-02-26 12:57:34 +00:00
421e7d2766 Add Saved Segments UI (variant D) (#4891)
* WIP

* Load members

* Assert that we know has_not_done will not work without changes

* Add tests

* Assert that dates are in the expected format

* Add tests, better authorship dates, api.js -> api.ts

* Add error panels

* Flatten errors on the API side

* Stop name copy from getting too long

* Make comparison mode and edit segment modes exclusive

* Fix flicker calculating space

* Fix issue with definite state not persisting

* Unhitch modals from query-context

* Separate API format and dashboard format of segment_data

* Clarify purpose of useDefiniteLocationState

* Tweak UI: site switcher, save as segment

* Fix issues with modals

* Remove commented and unnecessary code, better query context

* Fix too permissive site members dataset

* Make sure Segment doesn't show up as an option to customer without the FF

* Fix issue with 'See more' menu being present when it should not be

* Permit :has_not_done filter in segments

* Refactor to matching on filter list structure

* Flatten :and stemming from segment filters on first level

* Update test
2025-02-26 12:32:25 +00:00
hq1
ccdf50b734 Balance sessions across worker queues instead of explicit locks (#5113) 2025-02-26 08:03:52 +00:00
8aad9b1adc APIv2: Fix percentage metric 500s (#5099)
* Refactor: remove metrics argument from merge_imported()

* Support querying percentage without visitors metric

* Fix ordering by special metrics with imports causing a 500

We don't calculate all metrics directly on imports, hence cannot order
the import by them either.

* Changelog
2025-02-26 07:07:17 +00:00
cdb883cabc update locus (#5104) 2025-02-25 15:02:42 +00:00
704dfeff82 Update tracker deps (#5101)
* express -> devDependencies

* update deps
2025-02-25 13:05:30 +00:00
7dd5664992 Revert "Scroll Depth Release: make pageleave script the new default (#5105)" (#5112)
This reverts commit 079b40068c17ee623f8a9fcb2e84a4c9106b12ed.
2025-02-25 10:52:41 +00:00
079b40068c Scroll Depth Release: make pageleave script the new default (#5105)
* pageleave to default

* update report-sizes.js
2025-02-25 09:30:22 +00:00
74f9717f5b Scroll Depth Release: ingestion flag check for incremental load increase (#5106)
* check engagements flag on ingestion

* extend drop_reason
2025-02-25 09:19:59 +00:00
hq1
78689c89a6 Bump Repo queue params (#5109) 2025-02-24 16:23:23 +00:00
hq1
a0129a50fd Stop capturing UA errors (#5108) 2025-02-24 15:59:51 +00:00
hq1
52fa881646 Bugfix: allow Team updates via CRM (#5107) 2025-02-24 10:20:21 +00:00
4c0c9e8411 Ingestion logic for engagement_time (#5100) 2025-02-20 11:26:20 +00:00
75a8b19571 time-on-page: track engagement time in plausible.js (#5087)
* Track engagement time in plausible.js

* Test page going between background and foreground without sending

* Rename some variables

* Add comment on when we send information or not

* Extract a function

* Test SPA navigation

* Raise threshold

* Update tracker/src/plausible.js

Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>

---------

Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2025-02-20 10:31:24 +00:00
37a96293ee Add test demonstrating blank name is not accepted (#5098) 2025-02-20 09:59:44 +00:00
ef347e56c0 Use host network with make clickhouse (#5078)
Without this I couldn't get S3 exports to work locally as the ClickHouse
container wasn't able to access minio.
2025-02-20 07:17:18 +00:00
0e356c14f7 Ignore excess logger errors from Cowboy when sending to Sentry (#5096)
* Ignore excess logger errors from Cowboy when sending to Sentry

* Add test and simplify
2025-02-19 13:39:06 +00:00
482ba1face Migration to add new engagement_time column (#5092) 2025-02-19 10:20:00 +00:00
c91fb8c105 Fix bug: bfcache pageviews not firing (#5082)
* fix bug

* attempt to test bfcache in playwright

* Revert "attempt to test bfcache in playwright"

This reverts commit 35e8c4002cbc3f901318f824ac75b1a5ef31c68b.
2025-02-19 09:58:14 +00:00
dfeb2c332b Improve Page Scroll Goals UX (#5066)
* dont let blue background overflow rounded corners

* move scroll goal creation into a separate tab

* render goal type as Scroll

* add scroll goal edit capability

* implement automatic display name update in create form

* make UX more user-friendly

* autoselect the entire display name on first focus

* adjust tests

* set min value to 1 in scroll_threshold input

* rename goal trigger tab
2025-02-19 09:46:31 +00:00
bf010a1537 Implement support for multiple team owners and multiple teams per user (#5008)
* Add tests for `Teams.get_or_create/1` and `Teams.get_by_owner/1`

* Start populating `current_team` in assigns fetching value from session

* Clean up team passing in invitation services

* Make site transfer service handle multi-team scenario

* Handle multi-team and permission transfer errors on controller level

* Handle multi-teams in site creation on service and controller level

* Drop validation limiting full membership to a single team

* Make user deletion account for public team ownership

* Adjust feature availability checks for Stats API key

* Use current_team when determining limits on site transfer invitation

* Adjust trial upgrade email submission to account for multiple owners

* Remove unnecessary `Teams.load_for_site/1`

* Spike renaming `owner` and `ownership` relationships to plural versions

* Make HelpScout integration handle owner of multiple teams gracefully

* Add FIXME note

* Resolve paddle callback issue by always provisioning a new team when none passed

* Set `current_team` as `my_team` only when user is an owner

* Implement basics of Teams CRM

* Extend Teams CRM

* Further adjust User and Site CRM and refine Team CRM

* Convert Enterprise Plan CRM to refer to team directly and not via user

* Remove unused virtual fields from User schema

* Add note to HelpScout integration

* Allow listing multiple owners under Site Settings / People

* Remove unused User schema relations

* Fix current team fetch in auth plug and context

* Implement basic team switcher

* Ensure (site) editor role is properly handled in site actions auth

* Don't set `site_limit_exceeded` error marker on `permission_denied` error

* Link from HS integration to Team CRM instead of User CRM when available

* Ensure consistent ordering of preloaded owners

* Add `with_subscription` preload for optimisitation

* Add ability to search sites by team identifier

* Add ability to pick team when transferring ownership directly

* Fix failing HelpScout tests

* Scope by team when listing sites in dashboard and via API (optional)

* Add ability to search by team identifier in plans CRM lookup widget

* Add subscription plan, status and grace period to team status info

* Expose teams list in user CRM edit form and fix team details CRM view

* Fix Team Switcher styling

* Reorganise header nav menu

* Avoid additional queries when authenticating user

* Hide the pay/site transfer message on lock screen when teams FF is on

---------

Co-authored-by: Adam Rutkowski <hq@mtod.org>
2025-02-19 09:33:25 +00:00
7ae88c2c97 Make sure goal changeset error can be handled outside transaction (#5076)
* Make sure changeset error can be handled outside transaction

* Add test for goal form

* Also rollback upgrade required
2025-02-19 09:08:57 +00:00