Skip to content

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

Bump GA4 import page limit to max 250k (#4045)

Adrian Gruntkowskica25b6c7649c
diff --git a/lib/plausible/google/ga4/api.ex b/lib/plausible/google/ga4/api.ex
index cbbf84b7f6..986c7d79a0 100644
--- a/lib/plausible/google/ga4/api.ex
+++ b/lib/plausible/google/ga4/api.ex
@@ -14,7 +14,7 @@ defmodule Plausible.Google.GA4.API do
expires_at :: String.t()
}
- @per_page 50_000
+ @per_page 250_000
@backoff_factor :timer.seconds(10)
@max_attempts 5
@@ -37,6 +37,9 @@ defmodule Plausible.Google.GA4.API do
{:ok, accounts}
+ {:ok, _} ->
+ {:ok, []}
+
{:error, cause} ->
{:error, cause}
end
diff --git a/test/plausible/google/ga4/api_test.exs b/test/plausible/google/ga4/api_test.exs
index 98fbdcc348..d9d0c0a85d 100644
--- a/test/plausible/google/ga4/api_test.exs
+++ b/test/plausible/google/ga4/api_test.exs
@@ -27,6 +27,14 @@ defmodule Plausible.Google.GA4.APITest do
]}
] = accounts
end
+
+ test "handles empty response properly" do
+ expect(Plausible.HTTPClient.Mock, :get, fn _url, _opts ->
+ {:ok, %Finch.Response{status: 200, body: %{}}}
+ end)
+
+ assert {:ok, []} = GA4.API.list_properties("some_access_token")
+ end
end
describe "get_property/2" do