Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop listing UA views in Google data import flow #4309

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.

### Removed
- Deprecate `ECTO_IPV6` and `ECTO_CH_IPV6` env vars in CE plausible/analytics#4245
- Remove support for importing data from no longer available Universal Analytics

### Changed

Expand Down
5 changes: 1 addition & 4 deletions lib/plausible/google/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ defmodule Plausible.Google.API do
end

def list_properties_and_views(access_token) do
with {:ok, properties} <- Plausible.Google.GA4.API.list_properties(access_token),
{:ok, views} <- Plausible.Google.UA.API.list_views(access_token) do
{:ok, properties ++ views}
end
Plausible.Google.GA4.API.list_properties(access_token)
end

def get_property_or_view(access_token, property_or_view) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
describe "GET /:website/import/google-analytics/property-or-view" do
setup [:create_user, :log_in, :create_new_site]

test "lists Google Analytics views and properties", %{conn: conn, site: site} do
test "lists Google Analytics properties WITHOUT UA views", %{conn: conn, site: site} do
expect(
Plausible.HTTPClient.Mock,
:get,
Expand All @@ -54,15 +54,6 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
end
)

expect(
Plausible.HTTPClient.Mock,
:get,
fn _url, _opts ->
body = "fixture/ga_list_views.json" |> File.read!() |> Jason.decode!()
{:ok, %Finch.Response{body: body, status: 200}}
end
)

response =
conn
|> get("/#{site.domain}/import/google-analytics/property-or-view", %{
Expand All @@ -72,8 +63,8 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
})
|> html_response(200)

assert response =~ "57238190 - one.test"
assert response =~ "54460083 - two.test"
refute response =~ "57238190 - one.test"
refute response =~ "54460083 - two.test"
assert response =~ "account.one - GA4 (properties/428685906)"
assert response =~ "GA4 - Flood-It! (properties/153293282)"
assert response =~ "GA4 - Google Merch Shop (properties/213025502)"
Expand Down Expand Up @@ -343,15 +334,6 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
end
)

expect(
Plausible.HTTPClient.Mock,
:get,
fn _url, _opts ->
body = "fixture/ga_list_views.json" |> File.read!() |> Jason.decode!()
{:ok, %Finch.Response{body: body, status: 200}}
end
)

response =
conn
|> post("/#{site.domain}/import/google-analytics/property-or-view", %{
Expand Down Expand Up @@ -392,15 +374,6 @@ defmodule PlausibleWeb.GoogleAnalyticsControllerTest do
end
)

expect(
Plausible.HTTPClient.Mock,
:get,
fn _url, _opts ->
body = "fixture/ga_list_views.json" |> File.read!() |> Jason.decode!()
{:ok, %Finch.Response{body: body, status: 200}}
end
)

response =
conn
|> post("/#{site.domain}/import/google-analytics/property-or-view", %{
Expand Down