mirror of
https://github.com/plausible/analytics.git
synced 2024-10-26 18:32:25 +03:00
Include imported page paths in pageview goal suggestions (#4193)
This commit is contained in:
parent
b096057eef
commit
fd81ef2105
@ -16,7 +16,9 @@ defmodule PlausibleWeb.Live.GoalSettings do
|
|||||||
socket =
|
socket =
|
||||||
socket
|
socket
|
||||||
|> assign_new(:site, fn ->
|
|> assign_new(:site, fn ->
|
||||||
Sites.get_for_user!(user_id, domain, [:owner, :admin, :super_admin])
|
user_id
|
||||||
|
|> Sites.get_for_user!(domain, [:owner, :admin, :super_admin])
|
||||||
|
|> Plausible.Imported.load_import_data()
|
||||||
end)
|
end)
|
||||||
|> assign_new(:all_goals, fn %{site: site} ->
|
|> assign_new(:all_goals, fn %{site: site} ->
|
||||||
Goals.for_site(site, preload_funnels?: true)
|
Goals.for_site(site, preload_funnels?: true)
|
||||||
|
@ -319,7 +319,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def suggest_page_paths(input, _options, site) do
|
def suggest_page_paths(input, _options, site) do
|
||||||
query = Plausible.Stats.Query.from(site, %{})
|
query = Plausible.Stats.Query.from(site, %{"with_imported" => "true", "period" => "all"})
|
||||||
|
|
||||||
site
|
site
|
||||||
|> Plausible.Stats.filter_suggestions(query, "page", input)
|
|> Plausible.Stats.filter_suggestions(query, "page", input)
|
||||||
|
@ -162,6 +162,30 @@ defmodule PlausibleWeb.Live.GoalSettings.FormTest do
|
|||||||
assert html =~ "/go/home"
|
assert html =~ "/go/home"
|
||||||
refute html =~ "/go/to/page/1"
|
refute html =~ "/go/to/page/1"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "pageview combo considers imported pageviews as well", %{conn: conn, site: site} do
|
||||||
|
site_import = insert(:site_import, site: site)
|
||||||
|
|
||||||
|
populate_stats(site, site_import.id, [
|
||||||
|
build(:imported_pages, page: "/go/to/page/1", pageviews: 2),
|
||||||
|
build(:imported_pages, page: "/go/home", pageviews: 1)
|
||||||
|
])
|
||||||
|
|
||||||
|
lv = get_liveview(conn, site)
|
||||||
|
lv |> element(~s/a#pageview-tab/) |> render_click()
|
||||||
|
|
||||||
|
type_into_combo(lv, "page_path_input", "/go/to/p")
|
||||||
|
|
||||||
|
html = render(lv)
|
||||||
|
assert html =~ "Create "/go/to/p""
|
||||||
|
assert html =~ "/go/to/page/1"
|
||||||
|
refute html =~ "/go/home"
|
||||||
|
|
||||||
|
type_into_combo(lv, "page_path_input", "/go/h")
|
||||||
|
html = render(lv)
|
||||||
|
assert html =~ "/go/home"
|
||||||
|
refute html =~ "/go/to/page/1"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp type_into_combo(lv, id, text) do
|
defp type_into_combo(lv, id, text) do
|
||||||
|
Loading…
Reference in New Issue
Block a user