* Migration: add custom propos to goals + revisit unique constraints
* Update constraints in goal schema (and move module)
* Add a comment, not really related but useful?
* Implement querying for goals with custom props
* Optimize goal_join_data (down to one iteration) + include goal custom props
* Test goal custom propos addition + new constraints
* Test querying for goals with custom propos attached
* Test funnels made of goals with custom props
* Format
* Fixup test name
* Fixup migration
* Unified goal join macro
* Remove dupe test
* Clean up user_id usage
* Fixup test to match the description
* Revert "Temporary: make room for pre/post migration constraint names (#5942)"
This reverts commit e4bc6b8715.
---------
Co-authored-by: Uku Taht <uku.taht@gmail.com>
* rename query_parser_test to api_query_parser_test
* allow metrics to be nil in ParsedQueryParams
* swap now with relative_date in ParsedQueryParams
* add DashboardQueryParser
* stop defining defaults in ParsedQueryParams
* add DashboardQuerySerializer
* make sure parse -> serialize is a reversible transformation
* fix codespell
* fix test and silence credo
* fix another test
* parse and serialize with_imported
* cleaner decode_filters
* precompile do_not_url_encode_map and simplify uri_encode_permissive
* remove prepending ? logic
* Works
* Move shared link password check to AuthorizeSiteAccess plug
* Write changelog, cleanup
* Handle cookies already fetched in AuthorizeSiteAccess
* Unify shared link kind with plugins API entity
* rename QueryParser to ApiQueryParser
* move utc_time_range construction to querybuilder
* input_date_range format
* rename 30m atom to realtime_30m
* move build_comparison_date_range into do_build
* Limit preloading goals
* Enforce max limit for goals per site
* typo
* credo
* Remove logger call
* Integrate #5916
* Add a test
* Add test
* Unignore opts
* rename Query.build -> Query.parse_and_build
* rename two test files and move 4 %Query{} building functions into subfolder
* rename StatsAPIFilterParser to LegacyStatsAPIFilterParser
* rename Filters.QueryParser to QueryParser
* turn QueryParserTest into QueryParseAndBuildTest
* move query_parser.ex out of filters directory
* separate build from parse
* disable sample_threshold in the new intermediate build function, for now
* remove now redundant test util functions
* remove unused import
* address todo from earlier
* credo
* Make module names in sync with paths in tests
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Include revenue data for all detailed API responses except entry/exit pages
* Expose revenue data in all breakdown modals except entry/exit pages
* Add revenue metrics to breakdown response only on EE
* Change query builder to enable querying event metrics \w session dimension
* Add revenue metrics to entry and exit pages breakdowns
* Expose revenue data in entry and exit pages breakdowns
* Use `argMax` for `exit_page` and `exit_page_hostname` dimensions (h/t @ukutaht)
* Don't handle event-only dimensions with session-only metrics for now
* Add tests for all breakdowns
* Add clarifying comments in code
* Mark revenue tests as EE-only
* Migration: add consolidated views feature to enterprise plans
* Migration: Add user preferences per team table
* Update static plan definitions
* Add feature module definition
* Display consolidated view availability in crm
* Extend ConsolidatedView interface:
- add functions to manipulate user/team options (for CTA)
- require at least two sites in order to create a consolidated view
- require billing/plan compliance when computing eligibility
* Team/User preferences schema
* Implement consolidated view life cycle on /sites
Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Uku Taht <uku.taht@gmail.com>
* Enroll `consolidated_view` feature flag
* Consolidated view access hardening (+feature flag)
- require team-wise feature flag instead of super admin role
- redirect to /sites if the team isn't eligible any more
- enforce regular site in shared links controller
* Remove no longer needed `ConsolidatedView.enabled?/1`
* Alias PrimaDropdown
* No consolidates views for shared links
* Remove user argument from `ok_to_display?`
* Adjust a temporary test
* More elaborate alert
* Fix responsive design issues on sites page
- Fix z-index issue with button dropdown
- Fix truncation issue with team name
- Improve responsiveness of site cards
- Fix focus state of site cards
- Improve responsiveness of consolidated view CTA
- Improve design of prima_dropdown component
- Replace `+` with plus icons in dropdown items
* Use the plus icon for standalone "Add website" too
cc @sanne-san
* Format
* Fix z-index issue with dropdowns on sites page
* Remove TODOs
* Make consolidated view cards disappear when searching
* Clean up test
* Use per-team membership user preferences
* Use conditional instead of `with` statement
* Inline `ensure_eligible`
* Use `Map.fetch!` getting preference from default struct
* fixup
* Revert "Migration: add consolidated views feature to enterprise plans"
Will be included via main branch sync
This reverts commit 05bec55276.
* Fix and test feature-flag effect on both view and CTA cards
---------
Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
Co-authored-by: Uku Taht <uku.taht@gmail.com>
* fix weekly/monthly email reports + stats report tests
* fix title of stats email reports
* add missing test
* do not render review installation link for consolidated view traffic drop emails + test
* refactor email_match_query to predicate fn
* make site_id_query_filter a public fn
* make traffic spike notifications work + test
* improve spike/drop notification email copies
* fix ScheduleEmailReports introduction comment
* add tests for stats report email scheduling
* remove space before .
* apply credo suggestion
* fix CE tests, use module attrs for text assertions
* skip frequency comment
* single query
* rename to site_member
* single query for real
* Introduce `force_2fa` team policy and add API for toggling it
* Implement 2FA enforcement
* Make team policy available to CE too
* Improve copy (h/t @metmarkosaric)
* Send email to all team members when enforcing 2FA is enabled
* Only owners can enable and disable enforcing 2FA
* Don't send email to the user who enabled enforcing 2FA
* Add team selection screen to 2FA enforce exceptions
* Fix email URL
* Add tests
* Hide the Force 2FA section for non-owners completely
* Improve e-mail formatting
* Point at 2FA docs page for now
* Add changelog entry
* Reverse the exception to make dialyzer happy
* Fix a typo
Co-authored-by: Uku Taht <Uku.taht@gmail.com>
* Fix typespec 🤡 (h/t @ukutaht)
* Deliver force 2FA email notifications asynchronously
* Fix a typo in AlpineJS variable name (h/t @ukutaht)
* Put parameter in path helper instead of concatenating it as a string
* Improve and test audit logging of toggling 2FA enforcement
* Introduce 3 second delay before redirect
* Test audit logging only on EE
---------
Co-authored-by: Uku Taht <Uku.taht@gmail.com>
* render error reason in flash message (cs)
* exclude whole sections in consolidated site settings
* filter settings general
* make goal settings work + tests
* do not render funnels cta
* change title of consolidated view settings
* disable consolidated view revenue goal creation (UI)
* disable consolidated view revenue goal creation (API)
* change title of add goal form
* make Props.suggest_keys_to_allow work for consolidated views
* fix props settings rendering for consolidated views + basic tests
* fix form view + tests
* exclude site settings integrations too
* fix CE tests
* refactor check_no_currency_if_consolidated
* use consolidated? instead of regular?
* use revenue?
* lookup site_ids by site domain
* fix CE
* fix CE again
* extract display_name function
* Display 24h charts in CRM
* Move New Custom Plan button to the top of the page
* Allow custom plan deletion
* Add managed proxy price modifier to custom plan estimation
* Broadcast tracker script config updates
* Fix broadcast_put typespec
* Preload site association on CE
* Stop preloading uselessly
* Reload tracker_script_config on CE only
* add module name to service_error when check times out
Otherwise, it can sometimes remain unclear in the diagnostics, whether
it was InstallationV2 or InstallationV2CacheBust that timed out.
* Remove duplicate timeout logic
The current production logs show two types of verification timeouts:
* service_error: "Unhandled Browserless response status: 408" (vast
majority of cases)
* service_error: :timeout (only a few cases)
The latter happens when we hit the Req receive_timeout
(endpoint_timeout + 2s). I've seen Browserless not respect the timeout
param from time to time, so it's better to keep the timeout logic
"in-house" only.
* make service_error into a map with code and extra
* interpret temporary service errors
...but still consider them "unhandled" for telemetry, also notifying Sentry
and logging the warning.
* separate sentry messages (verification)
* make Verification.ChecksTest more DRY
* organize tests into describe blocks
* test verification telemetry and logging
* fix codespell
* get rid of legacy verification
* rename Checks.InstallationV2 -> Checks.VerifyInstallation
* delete Live.Installation and rename Live.InstallationV2 -> Live.Installation
* rename installationv2 (live) files as well
* delete old change-domain routes
Also rename current liveview modules and routes, removing the v2 suffix
* rename domain_change_v2 files, removing v2 suffix
* remove legacy JS verifier code
Also fix dockerignore and elixir.yml referencing a wrong priv path
* rename verification_v2_test -> verification_test
* remove v2 prefix from logs and sentry messages
* clean up duplicate external_sites_controller_test.exs tests
* remove flag
* fix typespec
* pass timeout as query param to Browserless too
* Fixup external sites controller test module (#5826)
* fix test description
* clean up detection sentry events + tests
* improve naming
---------
Co-authored-by: Artur Pata <artur.pata@gmail.com>
* add module name to service_error when check times out
Otherwise, it can sometimes remain unclear in the diagnostics, whether
it was InstallationV2 or InstallationV2CacheBust that timed out.
* Remove duplicate timeout logic
The current production logs show two types of verification timeouts:
* service_error: "Unhandled Browserless response status: 408" (vast
majority of cases)
* service_error: :timeout (only a few cases)
The latter happens when we hit the Req receive_timeout
(endpoint_timeout + 2s). I've seen Browserless not respect the timeout
param from time to time, so it's better to keep the timeout logic
"in-house" only.
* make service_error into a map with code and extra
* interpret temporary service errors
...but still consider them "unhandled" for telemetry, also notifying Sentry
and logging the warning.
* separate sentry messages (verification)
* make Verification.ChecksTest more DRY
* organize tests into describe blocks
* test verification telemetry and logging
* fix codespell
* get rid of legacy verification
* rename Checks.InstallationV2 -> Checks.VerifyInstallation
* delete Live.Installation and rename Live.InstallationV2 -> Live.Installation
* rename installationv2 (live) files as well
* delete old change-domain routes
Also rename current liveview modules and routes, removing the v2 suffix
* rename domain_change_v2 files, removing v2 suffix
* remove legacy JS verifier code
Also fix dockerignore and elixir.yml referencing a wrong priv path
* rename verification_v2_test -> verification_test
* remove v2 prefix from logs and sentry messages
* clean up duplicate external_sites_controller_test.exs tests
* remove flag
* fix typespec
* pass timeout as query param to Browserless too
* Fixup external sites controller test module (#5826)
* fix test description
---------
Co-authored-by: Artur Pata <artur.pata@gmail.com>
* Create static consolidated view UI on `/sites` page
- Improve existing site card layout
- Add static UI for the consolidated view
- Add dismissable upgrade card UI
- Extract favicon fetching logic to function
- Configure configurable fallback icon per route
- Add `/favicon/sources_globe/` route with different icon than `/favicon/sources/` to use on `/sites` page
* Improve the mobile view of the `/sites` page
* Minor query interface UX extension (#5713)
* Minor query interface extension
* !fixup
* !fixup
* Initial implementation of consolidated views on /sites
* Improve loading state
* no need to handle nil in main interface
* Juggle `can_manage_consolidated_view?`
* Require team setup in order to enable consolidated view
* nil catcher
* Fixup test fixture
* Don't show Consolidated View tab in CS if team is not setup
* Reorganize + test
* Remove comment
* Only show consolidated views to superadmins for now
* Remove temporary sleep
* CE unused bindings
* Clean up seeds
* EE
* Fixup test
* Test non-superadmin scenario
* Add a test guarding parity between small plots (consolidated vs individual)
* Move private function so CE won't complain
* See if the graphs are now similar at least :)
* sort
* Map keys are unsorted
* Ensure engagement events aren't counted as visitors on smol graphs
* just try and revert
* Revert "just try and revert"
This reverts commit 7584f59816.
* Simplify globe icon handling
* Remove unnecessary @rest
* Split tests into more focused cases
* Address jumpiness on furious refresh cycle
* Revert "Address jumpiness on furious refresh cycle"
This reverts commit 5c03b36918.
* Another attempt at jumpiness
* Enforce less noticeable lag applying the diff from loading to loaded
* Reduce flashing on stats load
---------
Co-authored-by: Sanne de Vries <sannedv@protonmail.com>
* Ensure `conn` from `Plug.Conn.read_body` is always passed down the pipeline
* Alter persistor related histogram metrics for better view of timings
* Update typespec
* Implement conversion of finch telemetry events to persistor specific ones
* Implement metrics and remove unused telemetry
* Adjust buckets
* Adjust buckets again and use milliseconds for unit uniformly
* detection handled/unhandled telemetry
* telemetry for verification too
* move sentry call next to telemetry event
* fix ce compile warning
* fix case clause
* remove implicit nil
* telemetry_event functions without argument
* Extract `has_sites_to_consolidate?` and `enabled?` for consolidated
views
* Ensure consolidated view is validated on site removal
* Verify condolidated view preconditions on regular site removal
* Hook only regular sites
* Alias
* Revert "Alias"
This reverts commit 5c95b1fa0a.
* Fix flaky test
* Always update stats start dates for consolidated views
* Ensure consistent regular site id ordering
* Introduce `reset_if_enabled/1` - along with site transfers and deletions
* Credo
* Re-implement reset_if_enabled to delete only when necessary
* Turn `has_sites_to_consolidate/1` private
* Move test to a different describe block
* Test `stats_start_date` refresh for consolidated views
* Credo
* Remove transaction wrap
* Fix typo
* move lib/plausible/installation_support/ -> /extra/lib/...
* extract Live.AwaitingPageviews exclusively for CE
* VerificationTest to ee only
* fix the rest of the compile/test errors on CE
* fix warning about not using default for optional argument
* move module attr