Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 opening
Expand Down
18 changes: 16 additions & 2 deletions lib/plausible_web/live/goal_settings/form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
def 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>
Expand Down Expand Up @@ -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/custom-event-goals" new_tab={true}>
our docs
</.styled_link>.
</div>

<.label for={"scroll_threshold_input_#{@suffix}"}>
Scroll Percentage Threshold (1-100)
</.label>
Expand Down Expand Up @@ -312,11 +326,11 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do

def 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 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
</.styled_link>.
</div>
Expand Down
2 changes: 1 addition & 1 deletion priv/json-schemas/query-api-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
},
{
"const": "scroll_depth",
"$comment": "only :internal"
"markdownDescription": "Average page scroll depth. Requires: `event:page` filter or `event:page` dimension"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion test/plausible/imported/csv_importer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand 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",
Expand 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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"]],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"]],
Expand Down
Loading