diff --git a/lib/plausible_web/controllers/google_analytics_controller.ex b/lib/plausible_web/controllers/google_analytics_controller.ex index b5b1055a1..3e8e5bcf7 100644 --- a/lib/plausible_web/controllers/google_analytics_controller.ex +++ b/lib/plausible_web/controllers/google_analytics_controller.ex @@ -301,22 +301,12 @@ defmodule PlausibleWeb.GoogleAnalyticsController do end defp schedule_job(site, current_user, property_or_view, opts) do - property? = Google.API.property?(property_or_view) - - importer_fun = - if property? do - &Imported.GoogleAnalytics4.new_import/3 - else - &Imported.UniversalAnalytics.new_import/3 - end - - opts = - if property? do - Keyword.put(opts, :property, property_or_view) - else - Keyword.put(opts, :view_id, property_or_view) - end - - importer_fun.(site, current_user, opts) + if Google.API.property?(property_or_view) do + opts = Keyword.put(opts, :property, property_or_view) + Imported.GoogleAnalytics4.new_import(site, current_user, opts) + else + opts = Keyword.put(opts, :view_id, property_or_view) + Imported.UniversalAnalytics.new_import(site, current_user, opts) + end end end