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
CS: allow searching by tracker script ID (#6275)
Adam Rutkowski4db97287c3a0
diff --git a/extra/lib/plausible/customer_support/resource/site.ex b/extra/lib/plausible/customer_support/resource/site.exindex fb65bd3f4f..56fbc8aaaf 100644--- a/extra/lib/plausible/customer_support/resource/site.ex+++ b/extra/lib/plausible/customer_support/resource/site.ex@@ -34,10 +34,11 @@ defmodule Plausible.CustomerSupport.Resource.Site dofrom s in Plausible.Site.regular(),inner_join: t in assoc(s, :team),inner_join: o in assoc(t, :owners),+ left_join: tsc in assoc(s, :tracker_script_configuration),where:ilike(s.domain, ^"%#{input}%") or ilike(t.name, ^"%#{input}%") orilike(o.name, ^"%#{input}%") or ilike(o.email, ^"%#{input}%") or- ilike(s.domain_changed_from, ^"%#{input}%"),+ ilike(s.domain_changed_from, ^"%#{input}%") or tsc.id == ^input,order_by: [desc: fragment("?.domain = ?", s, ^input),desc: fragment("?.domain_changed_from = ?", s, ^input),diff --git a/extra/lib/plausible_web/live/customer_support/components/layout.ex b/extra/lib/plausible_web/live/customer_support/components/layout.exindex fa6d6d605e..0b5f05234a 100644--- a/extra/lib/plausible_web/live/customer_support/components/layout.ex+++ b/extra/lib/plausible_web/live/customer_support/components/layout.ex@@ -59,7 +59,7 @@ defmodule PlausibleWeb.CustomerSupport.Components.Layout do<div class="font-mono"><strong>site:</strong>input<br /><p class="font-sans pl-2 mb-1">- Search for sites exclusively. Input will be checked against site's domain, team's name, owners' names and e-mails.+ Search for sites exclusively. Input will be checked against site's domain, team's name, owners' names and e-mails (fuzzy match) or against tracker script ID (exact match).</p><strong>user:</strong>input<br /><p class="font-sans pl-2 mb-1">diff --git a/test/plausible_web/live/customer_support_test.exs b/test/plausible_web/live/customer_support_test.exsindex 4dc8528a40..1e17697ad5 100644--- a/test/plausible_web/live/customer_support_test.exs+++ b/test/plausible_web/live/customer_support_test.exs@@ -183,6 +183,21 @@ defmodule PlausibleWeb.Live.CustomerSupportTest doassert_search_result(html, "site", site.id)end++ test "search sites by tracker script ID", %{conn: conn} do+ site = new_site()++ tracker_script_configuration =+ PlausibleWeb.Tracker.get_or_create_tracker_script_configuration!(site)++ {:ok, lv, _html} = live(conn, @cs_index)++ type_into_input(lv, "filter-text", "site:#{tracker_script_configuration.id}")++ html = render(lv)++ assert_search_result(html, "site", site.id)+ endenddefp assert_search_result(doc, type, id) do