diff --git a/CHANGELOG.md b/CHANGELOG.md index fc791d50a275..fbf24756648a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## Unreleased ### Added +- Average scroll depth metric +- Scroll Depth goals - Dashboard shows comparisons for all reports - UTM Medium report and API shows (gclid) and (msclkid) for paid searches when no explicit utm medium present. - Support for `case_sensitive: false` modifiers in Stats API V2 filters for case-insensitive searches. @@ -26,6 +28,7 @@ All notable changes to this project will be documented in this file. ### Fixed +- The tracker script now sends pageviews when a page gets loaded from bfcache - Fix returning filter suggestions for multiple custom property values in the dashboard Filter modal - Fix typo on login screen - Fix Direct / None details modal not opening diff --git a/lib/plausible_web/live/goal_settings/form.ex b/lib/plausible_web/live/goal_settings/form.ex index 816d46fe839a..55a2b0b75b58 100644 --- a/lib/plausible_web/live/goal_settings/form.ex +++ b/lib/plausible_web/live/goal_settings/form.ex @@ -179,6 +179,13 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do def pageview_fields(assigns) do ~H"""
+
+ Pageview goals allow you to measure how many people visit a specific page or section of your site. Learn more in + <.styled_link href="https://plausible.io/docs/pageview-goals" new_tab={true}> + our docs + . +
+ <.label for={"page_path_input_#{@suffix}"}> Page Path @@ -248,6 +255,13 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do ~H"""
+
+ Scroll Depth goals allow you to see how many people scroll beyond you desired scroll depth percentage threshold. Learn more in + <.styled_link href="https://plausible.io/docs/custom-event-goals" new_tab={true}> + our docs + . +
+ <.label for={"scroll_threshold_input_#{@suffix}"}> Scroll Percentage Threshold (1-100) @@ -312,11 +326,11 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do def custom_event_fields(assigns) do ~H""" -
+
Custom Events are not tracked by default - you have to configure them on your site to be sent to Plausible. See examples and learn more in - <.styled_link href="https://plausible.io/docs/custom-event-goals" new_tab={true}> + <.styled_link href="https://plausible.io/docs/scroll-depth" new_tab={true}> our docs .
diff --git a/priv/json-schemas/query-api-schema.json b/priv/json-schemas/query-api-schema.json index 0c95244ce979..76d8b075a378 100644 --- a/priv/json-schemas/query-api-schema.json +++ b/priv/json-schemas/query-api-schema.json @@ -272,7 +272,7 @@ }, { "const": "scroll_depth", - "$comment": "only :internal" + "markdownDescription": "Average page scroll depth. Requires: `event:page` filter or `event:page` dimension" } ] }, diff --git a/test/plausible/imported/csv_importer_test.exs b/test/plausible/imported/csv_importer_test.exs index 2c2f45734782..23730b793e44 100644 --- a/test/plausible/imported/csv_importer_test.exs +++ b/test/plausible/imported/csv_importer_test.exs @@ -1164,7 +1164,7 @@ defmodule Plausible.Imported.CSVImporterTest do ] query_scroll_depth_per_page = fn conn, site -> - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "date_range" => "all", diff --git a/test/plausible_web/controllers/api/external_stats_controller/query_imported_test.exs b/test/plausible_web/controllers/api/external_stats_controller/query_imported_test.exs index c3c92b30ae06..4d06e5abb3e4 100644 --- a/test/plausible_web/controllers/api/external_stats_controller/query_imported_test.exs +++ b/test/plausible_web/controllers/api/external_stats_controller/query_imported_test.exs @@ -1388,7 +1388,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryImportedTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["visitors", "scroll_depth"], "date_range" => "all", @@ -1476,7 +1476,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryImportedTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["visitors", "scroll_depth"], "date_range" => "all", @@ -1510,7 +1510,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryImportedTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["visitors", "scroll_depth"], "date_range" => ["2022-01-01", "2022-01-31"], @@ -1554,7 +1554,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryImportedTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["visitors", "scroll_depth"], "date_range" => "all", diff --git a/test/plausible_web/controllers/api/external_stats_controller/query_test.exs b/test/plausible_web/controllers/api/external_stats_controller/query_test.exs index 104fa08176be..81c0f99f1605 100644 --- a/test/plausible_web/controllers/api/external_stats_controller/query_test.exs +++ b/test/plausible_web/controllers/api/external_stats_controller/query_test.exs @@ -3724,16 +3724,18 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do describe "scroll_depth" do setup [:create_user, :create_site, :create_api_key, :use_api_key] - test "scroll depth is (not yet) available in public API", %{conn: conn, site: site} do + test "cannot query scroll depth without page filter or dimension", %{conn: conn, site: site} do conn = post(conn, "/api/v2/query", %{ "site_id" => site.domain, - "filters" => [["is", "event:page", ["/"]]], "date_range" => "all", "metrics" => ["scroll_depth"] }) - assert json_response(conn, 400)["error"] =~ "Invalid metric \"scroll_depth\"" + assert %{"error" => error} = json_response(conn, 400) + + assert error == + "Metric `scroll_depth` can only be queried with event:page filters or dimensions." end test "can query scroll_depth metric with a page filter", %{conn: conn, site: site} do @@ -3747,7 +3749,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "filters" => [["is", "event:page", ["/"]]], "date_range" => "all", @@ -3781,7 +3783,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "filters" => [["is", "event:page", ["/"]], ["is", "event:props:author", ["john"]]], "date_range" => "all", @@ -3793,13 +3795,13 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ] end - test "scroll depth is 0 when no engagement data in range", %{conn: conn, site: site} do + test "scroll depth is nil when no engagement data in range", %{conn: conn, site: site} do populate_stats(site, [ build(:pageview, timestamp: ~N[2021-01-01 00:00:00]) ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "filters" => [["is", "event:page", ["/"]]], "date_range" => "all", @@ -3811,9 +3813,9 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ] end - test "scroll depth is 0 when no data at all in range", %{conn: conn, site: site} do + test "scroll depth is nil when no data at all in range", %{conn: conn, site: site} do conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "filters" => [["is", "event:page", ["/"]]], "date_range" => "all", @@ -3845,7 +3847,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "date_range" => "all", @@ -3879,7 +3881,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "date_range" => "all", @@ -3908,7 +3910,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "date_range" => "all", @@ -3941,7 +3943,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "date_range" => "all", @@ -4028,7 +4030,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "order_by" => [["scroll_depth", "asc"]], @@ -4097,7 +4099,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "date_range" => "all", @@ -4169,7 +4171,7 @@ defmodule PlausibleWeb.Api.ExternalStatsController.QueryTest do ]) conn = - post(conn, "/api/v2/query-internal-test", %{ + post(conn, "/api/v2/query", %{ "site_id" => site.domain, "metrics" => ["scroll_depth"], "order_by" => [["scroll_depth", "desc"]],