Commit Graph

525 Commits

Author SHA1 Message Date
hq1
8733294d1b
Fix URLs breaking on date picker navigation (#4323)
This prevents the date picker from updating the URL
with data domain on each subsequent use. Only the query
string should be updated.
2024-07-09 10:52:00 +02:00
Marko Saric
379714c133
removing HI from the Top Pages details view (#4306) 2024-07-03 16:10:47 +02:00
hq1
839691d29f
Bugfix: custom props modal opens up with no filters (#4301) 2024-07-02 14:45:48 +02:00
hq1
c871759fc1
Bugfix: opening details UTM sources modal (#4295) 2024-07-01 12:39:55 +02:00
hq1
8188006c45
Fix new tab links + shared links losing URL context (#4278)
* Fix dashboard new tabs + preserve state for shared links

* Modal no longer needs site
2024-07-01 06:52:35 +02:00
Adam Rutkowski
5fae58e5e7 Revert "Make new tab dashboard links work (#4276)"
This reverts commit fa065c85a3.
2024-06-25 15:15:06 +02:00
hq1
fa065c85a3
Make new tab dashboard links work (#4276)
* Make new tab dashboard links work

* Urlencode domain

* Recognize shared links
2024-06-25 14:41:09 +02:00
Karl-Aksel Puulmann
70fca3e8d1
Fix browser version linking (#4259)
This was broken in https://github.com/plausible/analytics/pull/4246.

See also: https://3.basecamp.com/5308029/buckets/26383192/card_tables/cards/7514532175
2024-06-25 11:25:28 +03:00
hq1
59b1811368
Add max height/overflow to funnel picker (#4265) 2024-06-24 13:52:14 +02:00
Karl-Aksel Puulmann
284b4ebbf6
does_not_contain, new filters wildcard matching (#4228)
* Make goals accept wildcards in :is queries

* Add support for contains/does_not_contains in the backend

* Support all operations for event custom properties

* Support does_not_contain on the frontend

* Changelog entry

* Render filter operations nicely for does not contain

Found 3 extra pixels for operation dropdown

* Remove multiple_filters feature flag
2024-06-21 11:32:05 +03:00
Karl-Aksel Puulmann
ed8abf426b
Revert "Revert "Re-apply multiple filters in FE (#4219)" (#4223)" (#4227)
This reverts commit 2c05676d8e.
2024-06-21 11:31:02 +03:00
Adrian Gruntkowski
a7ddc1a141
Autoselect prop key (#4253)
* Autoselect propkey on opening properties breakdown

* reset propkey when query changes

* ignore custom prop filter when selecting a prop key

* throttle api requests

* Force loading state on combobox when loading propkey

* Remove artificial throttling of API requests

* Disable combobox when no prop keys are found

* drop prop_key and set loading true when query changes

* Update changelog

---------

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2024-06-21 11:02:39 +03:00
Uku Taht
486ee68ca8
Browser icon improvements (#4246)
* Use png for Safari icon

* Fix spacing for screen sizes

* Add browser icon to version drilldown
2024-06-20 17:32:08 +03:00
hq1
e453d364d4
Add WP Search Queries special goal (#4250) 2024-06-20 09:33:04 +02:00
Uku Taht
0060954372
Add browser icons (#4239)
* Add popular browser icons

* Adjust fallback icon color for dark mode

* Add changelog

* Add MIUI browser logo

* Fix Edge and MacOS in seeds

* Add smaller browser logos
2024-06-18 12:45:08 +03:00
Karl-Aksel Puulmann
2c05676d8e
Revert "Re-apply multiple filters in FE (#4219)" (#4223)
This reverts commit 77520390f8.
2024-06-13 12:45:50 +03:00
Karl-Aksel Puulmann
77520390f8
Re-apply multiple filters in FE (#4219)
* Revert "Revert "Multiple filters on the frontend (#4174)" (#4218)"

This reverts commit 2f7dcae991.

* Make city links work again

By enforcing everything sent to the BE is stringified. We do this at serialization-time to ensure old dashboard links still work
2024-06-13 09:56:15 +03:00
hq1
2f7dcae991
Revert "Multiple filters on the frontend (#4174)" (#4218)
This reverts commit e1f0002d2e.
2024-06-11 17:42:07 +03:00
Karl-Aksel Puulmann
e1f0002d2e
Multiple filters on the frontend (#4174)
* Add new logic for query parsing

Note this is not yet final, but this scaffolding will soon be used

* Send filters to BE in new encoding, flag add more button

* query.property -> query.dimensions

* Reduce number of operations for filtering

This helps ensure we can be consistent/simple with apiv2

* Update search console filter mapping

* Update filters sent from frontend

* Update new filter parsing

* Remove redundant clause

* Make filtering by event:goal work

* Handle * as old backend did - prefix/suffix by **, if not using wildcards already

* Update imports logic

* Credo warning

* Spacing for add row button in filter modals

* query fix

* LegacyDashboardFilterParser

* only single hostname filter allowed

---------

Co-authored-by: Uku Taht <uku.taht@gmail.com>
2024-06-11 14:22:53 +03:00
RobertJoonas
56a9a1c72d
Make sure initial load re-evaluates viewport width (#4214) 2024-06-11 13:28:59 +03:00
RobertJoonas
f6360b8241
Reapply Filters component refactor + fix regression (#4213)
* Revert "revert filters.js from 14cf650 (#4208)"

This reverts commit 4edeed33ca.

* fix bug with wrong var name

* Do not cancel api requests on the first dashboard render
2024-06-11 13:15:24 +03:00
RobertJoonas
4edeed33ca
revert filters.js from 14cf650 (#4208) 2024-06-10 17:27:20 +03:00
RobertJoonas
14cf6501c3
Refactor: Move from class to function components in React (#4198)
* Remove dead code (ComparisonContext)

The state of ComparisonContext is never read. We are storing all the
necessary state either in localStorage or in the `query` object.

* turn Filters into a fn comp

* turn Dashboard and CurrentVisitors into fn components

* turn Realtime into a fn comp

* Turn QueryLink into a fn comp

Also fix the "staticContext" console error when opening the period picker.
We don't need to pass all props into the Link component.

* extract a WRAPSTATE object
2024-06-10 13:03:39 +03:00
RobertJoonas
b49bbbc8bb
fix with-imported-switch for safari (#4194) 2024-06-06 13:04:00 +03:00
RobertJoonas
2a529b4eaa
Fix with imported switch + warning bubble renders (#4187)
* prioritize other skip_imported_reasons over not requested

* return with_imported_switch info from top stats

* fix the with-imported-switch component

* Refactor ImportedQueryUnsupportedWarning

* do not render warning bubble when imported data not requested

* stop displaying warning bubble before the API response is received

* fix tab switch pills jumping due to bubble height

* drop loading condition of ImportedQueryUnsupportedWarning for Funnels

* add explicit check for realtime when rendering the bubble

* remove unused JS imports

* rename snake_case to camelCase
2024-06-06 11:50:54 +03:00
Karl-Aksel Puulmann
272fdb81d0
Fix parsing = in jsonurl (#4185)
* Fix parsing = in jsonurl

This works around a bug in the jsonurl library where the literal causes a syntaxerror.
The urlencoded = however is handled without errors

* Changelog
2024-06-04 13:06:19 +02:00
RobertJoonas
1d3b068233
Implement filtering for imported data (#4118)
* move imported.ex to imported subfolder

* move constructing base imported query into a separate module

* Implement imported table deciding and filtering

+ tests for pages, entry_pages, exit_pages and common filter types

* add top stats test with country filter

* add timeseries test

* Drop bounce_rate and time_on_page from imported & page-filtered Top Stats

* rename field returned by top stats

* turn pages into a fn comp

* Move dashboard API results under a results key

...and also return the skip_imported_reason to the frontend to be used
for displaying warnings.

* extend ListReport component with an optional afterFetchData prop

* turn Devices into a fn comp

* add not_requested as a skip_imported_reason

* display warning icons in the dashboard

* Implement filtering suggestions and translate filter fields for imported

* WIP

* Improve and cover filtering suggestions with tests

* Rename imported suggestions query helpers

* fix screen size breakdown with screen size filter

* support filtering by the same suggestion property

* support location filters when fetching location suggestions

* support filtering by multiple props from the same table

* Implement filtering by goals

* Make views per visit metric work for import entry and exit pages

* Get rid of circular dependencies between Stats.Imported and Stats.Imported.Base

* Clean up Query struct manipulation in Breakdown

* Rename helper function for clarity

* Automatically refresh query struct state after modifications

* Shutup credo

* display imported warning bubble in prop breakdown section

* Render warning bubble for funnels whenever imported data is in the view

* Transform any operator on respective goal filters

* Fix percentage and conversion_rate calculation in presence of custom props

* add tests for for combining page and pageview goal filters

* add skip_refresh option to query tweaking functions

* add imported CR support for timeseries

* still show url breakdown when special goal + url in filter

* rename Query.refresh

* use flat_map instead of map and concat

* fix darkmode color

* Handle invalid imported region codes in suggestions gracefully

* Add an entry to CHANGELOG.md

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2024-06-03 12:29:08 +02:00
RobertJoonas
57e28f0da6
Make React frontend capable of reading API results under a results key (#4159)
* Make React frontend capable of reading API results under a results key

* remove redundant double negation

* Update assets/js/dashboard/stats/modals/props.js

add length key back

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

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2024-05-31 09:01:15 +01:00
Karl-Aksel Puulmann
e5c3eabe31
Fix linking in dashboard sources/utm details modal (#4151)
This was broken by a recent refactor and the links did not filter properly
2024-05-28 13:28:56 +02:00
RobertJoonas
4d7a67d294
Fix setting with_imported to false explicitly in the URL (#4148) 2024-05-27 15:27:23 +02:00
Karl-Aksel Puulmann
850cc30e7a
Fix opening a filter modal (#4123)
Follow-up to #4117

Opening a utm modal crashed if there was an existing page filter. Bug
struck in during a refactoring.
2024-05-23 10:54:08 +03:00
Karl-Aksel Puulmann
ab1416ba10
Fix special goal conversions (#4122)
Follow-up to https://github.com/plausible/analytics/pull/4117

Special goals (e.g. 404, Outbound link click) always reported (none) as
results due to a function returning the wrong value.
2024-05-23 10:53:54 +03:00
Karl-Aksel Puulmann
23a6431adb
Frontend: Use jsonurl, update filtering (#4117)
* Start refactoring, supporting jsonurl

* WIP: Listing of applied filters works

* WIP: Remove some unneeded hackery

* WIP: Handle country labels better

* WIP: Handle multiple filters better

* WIP: Serializing filters for API queries

* Split modal code into 3

* Merge code paths for prop and other filter modals

* Get suggestions working again

* Display prop filters properly

* Handle re-opening a props modal properly

* Better label handling

* Better linking to filter modals

* Remove unneeded component

* Standardize how we update query more

* Use updatedQuery to remove more usecases of URLSearchParams

* Dont export toFilterQuery

* Custom toString for PlausibleSearchParams

* Fix props suggestions/filtering

* Refactor isFilteringOnFixedValue

* Improved encoding - goals now work again

* fix a typo

* Handle more cases where query.filters[ is used

* Fix locations tab changing behavior

* Fix for `setQuery` not to double up ?

* Handle goal filters properly now

* Delete dead code

* Update special goals handling

* Update <ListReport /> linking

* Show labeled values in list of filters

* Updae Props component handling of storage keys

* re-add special case handling in devices view

* Fix modal-related typo

* Get updatedQuery callsites working

* Update location modals linking

* Update props details model linking logic

* Switch back tab from props when removing goal filter

* Remove query.filters usage from within <Referrers /> component

* Private escapeFilterValue

* Fix sources/index.js

* Legacy redirect logic

* Update comment

* Disabled options in props modal

* Update escaping and is_not operator

* Restore `false` search property handling meaning unset

* changelog

* Fix filtering after clicking on a map

* FilterOperatorSelector

* replaceFilterByPrefix

* Improve naming for filter modals/groups
2024-05-22 11:01:41 +03:00
Uku Taht
b2860d1602
Fix unselecting filter from filter modal (#4109) 2024-05-21 09:23:57 +02:00
Uku Taht
06e8118dab
Filtering Search Console keywords (#4077)
* Apply filters in search console request

* Remove dead code from search console modal

* Remove unimportant information from keyword modal

* Show invalid filters from search console

* Fix tests

* Add/Fix tests

* Fix typo

* Remove unused variable

* Fix typo

* Changelog entry

* Fix Credo

* Display impressions, CTR and position in keyword modal

* Undo change that should not have been committed

* Fix test

* Fix test

* filters -> search_console_filters
2024-05-14 09:56:55 +03:00
Adrian Gruntkowski
d7ca8d9600
Revert "Debug queries for super-admins (#4010)" (#4073)
This reverts commit dd493fdad2.
2024-05-06 15:05:17 +02:00
Karl-Aksel Puulmann
bcde2b8cf2
Add Yesterday as an time range option in the dashboard (#4040) 2024-05-02 14:57:10 +03:00
hq1
dd493fdad2
Debug queries for super-admins (#4010)
* Debug queries for super-admins

* Fixup

* Update lib/plausible/clickhouse_repo.ex

Co-authored-by: ruslandoga <doga.ruslan@gmail.com>

* Try again with https://github.com/plausible/analytics/pull/3699

It's still clunky 😅

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

* Move headers injection to a separate plug module

* Add tests

* Update repo test

* Format

* Add moduledoc

* Don't assume order in query_log

* Be patient about query_log maybe?

* huh?

* huh2

* Wait longer

* Guard against \x00 in response header - testing on stage

* Fixup

* fixup

* fixup

* s/debug_label/label

* Include `site_id` and `metadata` in `log_comment`

* Tolerate non-serializable log_comment contents

---------

Co-authored-by: ruslandoga <doga.ruslan@gmail.com>
Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
2024-04-30 09:57:28 +02:00
hq1
83643450c4
Remove obsolete feature flags (#4026) 2024-04-18 20:18:38 +02:00
RobertJoonas
f49bdef7dd
Fix main graph intervals (#4024)
* make sure valid intervals consider custom range

* make default intervals per period more logical

* remove unused function

* adjust defaults for custom range
2024-04-18 15:01:47 +01:00
Marko Saric
09612e21e7
Update search-terms.js (#4016) 2024-04-16 16:08:09 +02:00
hq1
f9f0407d68
Remove experimtnal_hostname_filter and keep it on by default (#3973)
* Remove `experimental_hostname_filter` and keep it on by default

* Catch up with changes done via e5b56dbe6
2024-04-04 17:20:16 +02:00
RobertJoonas
e5b56dbe62
Refactor VisitorGraph (#3936)
* Give a more semantic name to a function

* Make the LineGraph component thinner

* Move LineGraph into a separate file

* Move interval logic into interval-picker.js

This commit also fixes a bug where the interval name displayed inside
the picker component flickers the default interval when the graph is
loading.

The problem was that we were counting on graphData for returning us the
current interval: `let currentInterval = graphData?.interval`

We should always know the default interval before making the main-graph
request. Sending graphData to IntervalPicker component does not make
sense anyway.

* extract data fetching functions out of VisitorGraph component

* Return graph_metric key from Top Stats API

This commit introduces no behavioral changes - only starts returning an
additional field, allowing us to avoid the following logic in React:

1. Finding the metric names, given a stat display name. E.g.
   `Unique visitors (last 30 min) -> visitors`

2. Checking if a metric is graphable or not

* Move metric state into localStorage

This commit gets rid of the internal `metric` state in the VisitorGraph
component and starts using localStorage for that instead.

This commit also chains the main-graph request into the top-stats request
callback - meaning that we'll always fetch new graph data after top stats
are updated. And we do it all in a single function.

Doing so simplifies the loading state significantly, and also helps to
make it clear, that at all times, existing top stats are required before
we can fetch the graph. That's because the metric is determined by which
Top stats are returned (for example, we can't be sure whether revenue
metrics will be returned or not).

* Make sure graph tooltip says "Converted Visitors"

* Extract a StatsExport function component

Again, instead of relying on `graphData?.interval` we can read it from
localStorage, or default to the largest interval available. The export
should not be dependant on the graph.

* Extract SamplingNotice function component

* Extract WithImportedSwitch function component

* Stop "lazy-loading" the graph and top stats

Since the container is always on top on the page, it will be visible on
the first render in any case - no matter the screen size.

* Turn VisitorGraph into a function component

* Display empty container until everything has loaded

* Do not display loading spinner on realtime ticks

* Turn Top Stats into a fn component

* fetch top stats and graph async

* Make sure revenue metrics can remain on the graph

* Add an extra check to canMetricBeGraphed

* fix typo

* remove redundant double negation
2024-04-04 13:39:55 +01:00
hq1
6af80dd246
Filter by hostnames (#3963)
* CH Migration: exit/entry hostnames in sessions_v2

* Leave only exit_page_hostname, we already record hostnames

* Use ClickHouse DDL in favour of ecto so that cluster is included

* Compress with ZSTD(3)

* Expose Hostname filter in the dashboard dropdown

* Add `exit_page_hostname` to ClickHouse `sessions_v2` schema

* Start tracking hostname changes in sessions

* Implement hostname filter suggestions

* Enable filtering by `event:hostname`

* Add tests for filtering by hostnames

* Ensure filter suggestions work for exit pages too

* Allow overriding hostnames with `send_pageview` mix task

* Remove `:window_time_on_page` flag

It seems that we can remove it after all?

* Initialize `experimental_hostname_filter` query parameter

* Rewrite cache store behaviour with regards to session hostnames

* Work around inconsistent session merging

So that `populate_stats` can get closer to actual ingestion

* Improve top stats test

* Make it possible to filter sessions by entry/exit hostnames

* Update pages tests

* Expose `experimental_hostname_filtering` temporarily in the UI

* Untested yet: also apply experimental filtering to sources

* Introduce `hostname_filter` feature flag

* Format

* Test top sources with hostname filter + experimental flag
2024-04-04 10:48:30 +02:00
Adrian Gruntkowski
23a3699dd7
Improve import stats toggle and with_imported flag computation (#3960)
* Check import presence across all imports and not just the first one

Also, simplify imported data toggle rendering to not explicitly
refer to the earliest import source.

* Change imported stats toggle icon in dashboard

* Test `Imported.get_imports_date_range/1`

* Simplify failed UA/GA import email copy
2024-04-02 12:53:19 +02:00
ruslandoga
c263df5805
CSV imports (UI) (#3845)
* add basic ui

* remove TODO

* credo

* allow folder upload

* redirect external

* mention folder, use folder icon for file picker

* back to multiple file upload

* mention zip

* escape dots in archive filename
2024-03-26 12:55:14 +01:00
Uku Taht
1d017e86a1
Fix escaping of source filters (#3930)
* Fix escaping of source filters

* CHANGELOG

* Fix typo

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

---------

Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
Co-authored-by: Karl-Aksel Puulmann <macobo@users.noreply.github.com>
2024-03-22 11:16:44 +01:00
RobertJoonas
fb61f0b425
Capitalize Total Conversions in graph tooltip (#3934) 2024-03-22 09:51:17 +00:00
RobertJoonas
d6e1e8bebd
Put total conversions on the graph + goal-filtered CSV export improvements (#3929)
* Add validation for the events metric in main_graph

* Test the already existing events metric support in main-graph

* Put total conversions on the graph

* extract main_graph_csv function (refactor only)

* add total_conversions and conversion_rate to goal-filtered visitors.csv

* update changelog
2024-03-22 09:35:23 +00:00
Uku Taht
561dcd821e
Mask pathanme in filter menu event (#3932) 2024-03-22 10:25:10 +02:00