Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Scroll Depth Release (#5120)
RobertJoonas3f43cfa077b2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0c416f84be..e47866bf7d 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.@@ -31,6 +33,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 openingdiff --git a/lib/plausible_web/live/goal_settings/form.ex b/lib/plausible_web/live/goal_settings/form.exindex 816d46fe83..1c4dcd8022 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 dodef pageview_fields(assigns) do~H"""<div id="pageviews-form" class="py-2" {@rest}>+ <div class="text-sm pb-6 text-gray-500 dark:text-gray-400 text-justify rounded-md">+ 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+ </.styled_link>.+ </div>+<.label for={"page_path_input_#{@suffix}"}>Page Path</.label>@@ -248,6 +255,13 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do~H"""<div id="scroll-form" class="py-2" x-data={@js} {@rest}>+ <div class="text-sm pb-6 text-gray-500 dark:text-gray-400 text-justify rounded-md">+ 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/scroll-depth" new_tab={true}>+ our docs+ </.styled_link>.+ </div>+<.label for={"scroll_threshold_input_#{@suffix}"}>Scroll Percentage Threshold (1-100)</.label>@@ -312,7 +326,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form dodef custom_event_fields(assigns) do~H"""- <div id="custom-events-form" class="my-6" {@rest}>+ <div id="custom-events-form" class="py-2" {@rest}><div id="event-fields"><div class="text-sm pb-6 text-gray-500 dark:text-gray-400 text-justify rounded-md">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 indiff --git a/priv/json-schemas/query-api-schema.json b/priv/json-schemas/query-api-schema.jsonindex 2a8d54088e..46ae2613d6 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.exsindex 2c2f457347..23730b793e 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.exsindex c3c92b30ae..4d06e5abb3 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.exsindex fa62fc7a83..921289a2a8 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 dodescribe "scroll_depth" dosetup [: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} doconn =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."endtest "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} dopopulate_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} doconn =- 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"]],