Commit Graph

2859 Commits

Author SHA1 Message Date
Uku Taht
0ac196d3d9
Improve how long URLs are displayed in dashboard (#4405)
* Do not truncate text in modals

* Add filter value to filter tooltip

* Show title for add filter links in ListReport and BreakdownModal
2024-07-31 10:21:41 +03:00
Uku Taht
a1ee58426e
Implement goal contains filter + search in Conversions > Details (#4404)
* Implement goal contains

* add search into ConversionsModal

---------

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
2024-07-31 10:21:30 +03:00
Uku Taht
05b70e37a8
Generate goal filter SQL from postgres goals (#4391)
* Use goals from postgres to build goal filter

* Remove unnecessary goal preloading

* Add contains filter for goals

* Make sure the correct imported tables are used when goals are in filters

* Remove 'contains' filter type for now

* Remove TODO comment

* Fix QueryParser test

* move goals.ex into a goals subfolder

* extract goal filtering logic into a separate module

* remove duplication from Imported.Base

* Extract `get_filter_goals` function

* Credo suggestions

* Credo ignore nesting

* apply suggestion - remove Sql.Util

* apply suggestion - pass imported? via opts

* remove duplicate function

* Uncomment tests

* Fix 500 error with goal suggestions

---------

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
2024-07-30 12:07:23 +03:00
Adrian Gruntkowski
783740468d
Update ua_inspector fork to sanitize multi-part prereleases properly (#4398)
* Update `ua_inspector` fork to sanitize multi-part prereleases properly

* Add regression tests

* Make another version bump to include a fix for a missed corner case
2024-07-29 11:10:27 +02:00
Artur Pata
785bacbaf7
Fix extraneous link fragment (#4400) 2024-07-29 09:45:26 +03:00
Adrian Gruntkowski
556c896936
Add ability to lookup by email and site domain in HelpScout integration (#4377)
* Add ability to lookup by email and site domain in HelpScout integration

* Handle callback with invalid parameters gracefully

* Add routine adjusting iframe height to the content of HS integration

* Add requestStorageAccess routine to support iframe cookies in Safari

* Fill first email pick when on failed user lookup

* Fix a typo in a comment
2024-07-26 16:26:51 +02:00
RobertJoonas
37014c86a8
Tracking improvements (#4392)
* track browser_language, theme, and logged_in for 'Filter Menu: Open'

* track props for 'Signup' and 'Signup via invitation'

* do not track theme as 'system' for non-logged-in users

* fix tests
2024-07-26 15:24:55 +02:00
Adrian Gruntkowski
df5e2cba12
Create migration adding help_scout_mappings table (#4395) 2024-07-26 15:22:59 +02:00
Adrian Gruntkowski
c11e9daa63
Use forked ua_inspector version sanitizing prerelease in versions (#4374) 2024-07-26 15:22:33 +02:00
Adrian Gruntkowski
e2d1714f90
Make time range filter for sessions not break sample size estimation (#4394) 2024-07-26 16:19:11 +03:00
Adrian Gruntkowski
c862f15f0c
Revert "Install newest @tanstack/react-router (#4384)" (#4393)
This reverts commit 28cf3ff2b2.
2024-07-26 11:58:58 +02:00
Adrian Gruntkowski
590785794f
Add search_query to internal props (#4390) 2024-07-26 09:40:23 +02:00
Artur Pata
28cf3ff2b2
Install newest @tanstack/react-router (#4384)
* Install @tanstack/react-router

* Fix with imported switch

* Refactor redirect to new search parser

* Deregister timeout in ComparisonInput

* Comment uses of window.location

* Fix with imported switch appearing in realtime dashboard

* Handle not found routes more gracefully
2024-07-24 15:14:00 +03:00
RobertJoonas
6ed4f3ad69
update changelog (#4383) 2024-07-23 12:06:32 +03:00
Uku Taht
49bb57f601
Fix email report sentry errors (#4381)
* Fix missing email param on email unsubscribe

* Guard against email report being deleted
2024-07-23 12:05:42 +03:00
RobertJoonas
2f87832532
Implement search and pagination in Google Keywords modal (#4378)
* Extend the GSC API with search functionality

* Fix typo in error tuple atom

* log GSC errors

* rename confusing variable name

* Fix the API response format and error handling

* Read results under the `results` key to be consistent with other
  endpoints

* Return errors with a non-200 status code, and with an error payload
  that will be well constructed into ApiError

* rebuild Google Keywords modal with useAPIClient

* Add pagination support in Search Terms API

* delete unused fixture file

* rename fixture files

* fix tests
2024-07-23 11:53:52 +03:00
RobertJoonas
afc2fbaeb2
fix location labels (#4382) 2024-07-23 11:53:29 +03:00
ruslandoga
1f2ebe4d2c
Remove Timex.today (#4357)
* remove Timex.today

* format
2024-07-23 09:02:14 +02:00
ruslandoga
4325bba5ba
Update locations (#4366) 2024-07-23 09:02:02 +02:00
RobertJoonas
2edf3c94a3
fix sending endpoint prop from sources and countries modals (#4376) 2024-07-22 11:42:52 +03:00
Artur Pata
1acbbf292f
Install react-query (#4361)
* WIP

* Fix issue with more than one page cached

* Make sure we don't access properties of undefined objects

* slight cleanup

* reset limit to 100

* add back the bottom loading spinner when fetching next page

* disable refetchOnWindowFocus in the global queryClient

* render bottom loading spinner only when fetching next page

* create a wrapper for react-query

* fix exhaustive deps warnings in modals

* always pass the full api path to BreakdownModal

* improve function doc

---------

Co-authored-by: Robert Joonas <robertjoonas16@gmail.com>
Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2024-07-22 11:09:45 +03:00
Adrian Gruntkowski
0310cecef8
Add listing sites, goals and custom props to Sites API (#4302)
* Add listing sites, goals and custom props to Sites API

* Rename exmaple props in tests

* Rename `allowed_custom_props` -> `custom_properties`

* Expose goal name in GET endpoints for goals in Sites API

* Bump default pagination limit to 100 and max to 1000

* Introduce Goal.name/display_name and use the first one for name in API

* Extend goal list response but hide currency

* Settle on `display_name` instead of `name`

* Allow viewer members to get site details and list site goals

* Don't include currency in goal's display name
2024-07-19 10:05:54 +02:00
hq1
1c39f06ae8
Add curl browser icon (#4372) 2024-07-18 15:30:28 +02:00
hq1
feea0628c4
Add margin to CRM link (#4373) 2024-07-18 15:30:16 +02:00
hq1
1488683d26
Implement UI to edit existing funnels (#4369)
* Update tailwind config

Turns out `extra` wasn't scanned properly with
previous wildcards. I don't care any more, it's not slow.

* Add interface for updating funnels

* Extend ComboBox with the ability to preselect an initial value

* Implement editing funnels UI

* Update CHANGELOG

* s/add_funnel/setup_funnel

* modal width 2/5 => 2/3

* Let's not make the list disappear on modal pop-up

* Fix the damn modal width again

* Watch extra dir

* Format

* Remove commented code

The test is implemented elsewhere

* Track funnel modified to drop default selection

* Fix screen size adoption and format large numbers

* Preserve currency so that string casting includes it

* Format

* Fix ComboBox attribute for preselected option
2024-07-17 22:04:36 +02:00
Adrian Gruntkowski
1da1da9421
Fix flaky tests in Plausible.Auth.TOTPTest (#4362) 2024-07-16 16:50:52 +02:00
RobertJoonas
5a58b5cb99
Fix debounce (#4349)
* Replace useDebouncedEffect with useDebounce

This commit refactors the debouncing mechanism in a more extendable way.
Using debounce as a hook that returns a callback (rather than an effect)
makes it reusable for Combobox. This way the useDebounce hook does not
need to worry about whether the function should be called on the first
render or not.

This commit also gets rid of redundant doubled search state.

* rename input to search in Combobox

* Fix debounce in Combobox

* remove debounce-promise

* Fix React CI warnings in PlausibleCombobox

* Silence NPM CI in custom-hooks.js

* cancel scheduled API calls in useDebounce hook when unmounted
2024-07-16 12:15:45 +03:00
Uku Taht
28787198b2
Fix present_index for daily, weekly and monthly intervals (#4358)
* Fix present_index for daily, weekly and monthly intervals

* Add test for present_index
2024-07-16 12:12:38 +03:00
ruslandoga
ba77f0513e
use nimble_csv everywhere (#4183) 2024-07-16 12:12:29 +03:00
Adrian Gruntkowski
7015075e12
Show number of owned sites in HS integration with a link to sites list in CRM (#4355) 2024-07-16 09:18:34 +02:00
ruslandoga
f09db60207
Remove Timex.shift in app (#4338)
* rm Timex.shift in app

* update current_visitors_12h/1 as well

* type and fix
2024-07-15 13:31:58 +02:00
Uku Taht
42d2a6f3b3
Nicer keybind hint styling (#4336)
* Nicer keybind hints

* Make hints the same size
2024-07-15 13:06:14 +02:00
ruslandoga
b988364203
Improve PG unix sockets configuration (#4202)
* improve pg unix sockets configuration

* changelog

* don't use test env in config tests
2024-07-15 13:05:31 +02:00
ruslandoga
8a77968c34
Update bamboo_mua to disable MX lookups when relay is used (#4350)
* update bamboo_mua to disable mx lookups when relay is used

* changelog
2024-07-15 12:03:06 +02:00
ruslandoga
14d5a8028f
Don't require TOTP vault key in CE (#4317) 2024-07-15 12:02:31 +02:00
ruslandoga
530951780c
Fix relay-without-auth MUA config (#4298) 2024-07-15 12:01:57 +02:00
ruslandoga
922b9ab4d6
Allow to configure Finch pools (#4270) 2024-07-15 12:01:36 +02:00
Adrian Gruntkowski
1c5c4a25aa
HelpScout integration (#4327)
* Implement basic HelpScout integration

* Set 127.0.0.1 as a default customer IP in `Plans.with_prices/2`

* Use `is_nil/1` instead of `... == nil` (h/t @aerosol)

* Use `Path.join/1,2` to build API URLs a bit more safely (h/t @aerosol)

* Check for locked sites entirely within query logic

* Move conditional start of HelpScout vault to compile-time

* Include customer_id in error sent to Sentry

* Use `Plug.Crypto.secure_compare/2` for constant-time signature comparison

* Refactor token request function

* Use `Path.join/1` in one more spot

* Use route helper to build CRM URL
2024-07-12 12:01:59 +02:00
Adrian Gruntkowski
ff778436c4
Add migration for table storing HelpScout credentials (#4346) 2024-07-12 11:35:41 +02:00
Artur Pata
79188a90b7
Remove query and site props passing from everywhere except class components (#4340)
* Remove query and site props passing from everywhere except class components

* Fix invalid import
2024-07-12 10:59:26 +03:00
hq1
d565175c13
Remove verification related feature flags (#4345)
- `:verification` flag is no longer needed,
   however we'll keep the old "awaiting first pageview" flow
   for Community Edition where verification is not available
   by default
 - `:traffic_drop_notifications` have been tested and should
   be enabled for everyone
2024-07-12 09:43:54 +02:00
hq1
a2497f6f8c
Open verification modal when following drop notification link (#4344)
* Open verification modal when following drop notification link

* Add test

* Fixup

* Move `open-modal` event to Components.Modal API
2024-07-12 06:26:40 +02:00
hq1
d56bb2b4d5
Implement traffic drop notifications (#4300)
* Expose current visitors 12h aggregate

* Remove unused site association

* Distinct drop/spike notification factories

* Rename modules accordingly + implement drop handling

* Rename periodic oban service

* Implement drop email

* Rest of the owl

* Update changelog

* Update moduledoc

* Update moduledoc

* Min threshold to 1

* Threshold 1

* Remove merge artifact

* Put panel behind a feature flag

* Format
2024-07-11 14:55:18 +02:00
Karl-Aksel Puulmann
3ab47e6401
Remove SAMPLE BY from an events query that joins sessions (#4341)
Some users are reporting wrong results for stats querying from events table
but with session filters.

This seems to be caused by sampling: Namely both tables end up sampled and the
incorrect sample rate seems to get used.

This is sadly impossible to test for in our test suite, but reveals itself in
production with the following query:

```sql
SELECT
    toUInt64 (round(uniq (se0.user_id) * any(_sample_factor))) AS visitors
FROM
    events_v2 AS se0 SAMPLE 20000000
    INNER JOIN (
        SELECT
            sss0.session_id AS session_id,
            any(_sample_factor) AS _sample_factor
        FROM
            sessions_v2 AS sss0 SAMPLE 20000000
        WHERE
            (sss0.site_id = _CAST (8195000, 'Int64'))
            AND (sss0.timestamp >= _CAST (1720497600, 'DateTime'))
            AND (sss0.start < _CAST (1720584000, 'DateTime'))
            AND (sss0.entry_page IN ('/'))
            AND (sss0.sign = 1)
        GROUP BY
            sss0.session_id
    ) AS ss1 ON se0.session_id = ss1.session_id
WHERE
    (se0.site_id = _CAST (8195000, 'Int64'))
    AND (se0.timestamp >= _CAST (1720497600, 'DateTime'))
    AND (se0.timestamp < _CAST (1720584000, 'DateTime'))
```

By removing the inner query SAMPLE clause the result changes >50%

Related old PR: https://github.com/plausible/analytics/pull/2962

This will likely require more work in the future so looking forward to that -
after my vacation.
2024-07-11 15:08:20 +03:00
hq1
76da6b49a1
Migration: add traffic change type (#4325)
* Migration: add traffic change type

* Update schema
2024-07-11 11:01:11 +02:00
Karl-Aksel Puulmann
0114689779
fix(TimeSeries): Work around weird time zones (#4337)
* Refactor Expression.dimension to accept q

* Handle quarter- and half-hour timezones

Previously APIv2 output didn't start at a full hour for these time zones
and main graph was blank

The core reasoning is that ClickHouse `timeSlots` is not time-zone
aware and works off of unix epoch - meaning that in time zones which
have an offset of 5:45 the "hours" reported would start at minute :45.

The fix is kind of silly - we now divide each hour into 4 and handle
things that way.

Related basecamp issue: https://3.basecamp.com/5308029/buckets/36789884/card_tables/cards/7590936581

* Fix test typo
2024-07-11 11:48:16 +03:00
ruslandoga
13a95c879a
bump cache version (#4339) 2024-07-11 11:37:57 +03:00
Artur Pata
2dd2f058d1
Alleviate props passing: institute UserContext, QueryContext, SiteContext (#4334)
* Alleviate props passing: institute UserContext, QueryContext, SiteContext

* Remove unnecessary memo, fix SiteContext defaultValues
2024-07-10 17:02:05 +03:00
Karl-Aksel Puulmann
645b81376c
fix(main-graph): fix 12mo and other comparisons with blanks (#4333)
Some comparisons return __blank__ values. After recent time series fix,
this blew up when trying to parse __blank__ as a date.

This fixes the issue and adds a test for a period with __blank__ values

Co-authored-by: RobertJoonas <56999674+RobertJoonas@users.noreply.github.com>
2024-07-10 15:46:31 +03:00
Karl-Aksel Puulmann
4d19603693
fix: Calculate revenue metrics correctly when including imports (#4335)
Previously, revenue metrics were reported as 0.0$ when imports were included with
APIv2. This is because the metrics were not properly included/forwarded by the
imports query.

Not sure how long this bug has persisted, but eh.
2024-07-10 15:10:29 +03:00