diff --git a/lib/plausible/google/api.ex b/lib/plausible/google/api.ex index d57d22659..a1da6565f 100644 --- a/lib/plausible/google/api.ex +++ b/lib/plausible/google/api.ex @@ -296,8 +296,6 @@ defmodule Plausible.Google.Api do pageToken: page_token } - Logger.debug(report) - res = HTTPoison.post!( "https://analyticsreporting.googleapis.com/v4/reports:batchGet", @@ -305,8 +303,6 @@ defmodule Plausible.Google.Api do Authorization: "Bearer #{request.auth.access_token}" ) - Logger.debug(res.body) - if res.status_code == 200 do report = List.first(Jason.decode!(res.body)["reports"]) data = report["data"]["rows"] diff --git a/lib/plausible_web/templates/site/settings_general.html.eex b/lib/plausible_web/templates/site/settings_general.html.eex index 6daad6dd2..51b24d3c3 100644 --- a/lib/plausible_web/templates/site/settings_general.html.eex +++ b/lib/plausible_web/templates/site/settings_general.html.eex @@ -83,9 +83,15 @@
Linked Google account: <%= @site.google_auth.email %> + <%= if @imported_data && @imported_data.status == "error" do %> ++
Select the Google Analytics view id you would like to import data from.
diff --git a/lib/telemetry.ex b/lib/telemetry.ex index b9dd8c7c0..ac1fd1d4e 100644 --- a/lib/telemetry.ex +++ b/lib/telemetry.ex @@ -5,10 +5,20 @@ defmodule ErrorReporter do |> Map.take([:id, :args, :meta, :queue, :worker]) |> Map.merge(measure) + maybe_log_import_error(job) + Sentry.capture_exception(meta.error, stacktrace: meta.stacktrace, extra: extra) end def handle_event([:oban, :circuit, :trip], _measure, meta, _) do Sentry.capture_exception(meta.error, stacktrace: meta.stacktrace, extra: meta) end + + defp maybe_log_import_error(job) do + site = Plausible.Repo.get(Plausible.Site, job.args["site_id"]) + + if site do + Plausible.Site.import_failure(site) |> Plausible.Repo.update!() + end + end end