Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Show real view ID

Uku Taht445b8c5d438c
diff --git a/lib/plausible_web/controllers/site_controller.ex b/lib/plausible_web/controllers/site_controller.ex
index cb90523255..b5dfe7309f 100644
--- a/lib/plausible_web/controllers/site_controller.ex
+++ b/lib/plausible_web/controllers/site_controller.ex
@@ -663,14 +663,15 @@ defmodule PlausibleWeb.SiteController do
# TODO: Plausible.Google.Api.get_analytics_start_date(access_token)
start_date = {:ok, ~D[2019-01-02]}
end_date = Plausible.Stats.Clickhouse.pageview_start_date_local(site)
+ {:ok, view_ids} = Plausible.Google.Api.get_analytics_view_ids(access_token)
conn
|> assign(:skip_plausible_tracking, true)
|> render("import_from_google_confirm.html",
access_token: access_token,
site: site,
- # TODO: Also send the name here
- view_id: view_id,
+ view_ids: view_ids,
+ selected_view_id: view_id,
start_date: start_date,
end_date: end_date,
layout: {PlausibleWeb.LayoutView, "focus.html"}
diff --git a/lib/plausible_web/templates/site/import_from_google_confirm.html.eex b/lib/plausible_web/templates/site/import_from_google_confirm.html.eex
index 2298054b59..422feb1849 100644
--- a/lib/plausible_web/templates/site/import_from_google_confirm.html.eex
+++ b/lib/plausible_web/templates/site/import_from_google_confirm.html.eex
@@ -7,16 +7,15 @@
<% {:ok, start_date} -> %>
<div class="mt-6 text-sm text-gray-500">
- Choose the view in your Google Analytics account that will be imported to the <%= @site.domain %> dashboard.
+ Choose the view in your Google Analytics account that will be imported to the <%= @site.domain %> dashboard
</div>
<div class="mt-3">
<%= label f, :view_id, "Google Analytics view", class: "block text-sm font-medium text-gray-700" %>
- <%= text_input f, :view_id, value: @view_id, readonly: "true", class: "mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md" %>
+ <%= select f, :view_id, @view_ids, readonly: "true", selected: @selected_view_id, class: "mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md" %>
</div>
<div class="mt-6 text-sm text-gray-500">
- We will import historical data from your first Google Analytics visitor to your first Plausible visitor. If you'd
- like to import data for a different time period, please contact support.
+ Import historical data from your first Google Analytics visitor to your first Plausible visitor
</div>
<div class="flex justify-between mt-3">
<div class="w-36">