View Source Plausible.Google.UA.API (Plausible v0.0.1)
API for Universal Analytics
Summary
Functions
Returns a single Google Analytics view if the user has access to it.
Imports stats from a Google Analytics UA view to a Plausible site.
Lists Google Analytics views grouped by hostname.
Types
Functions
@spec fetch_and_persist(Plausible.Google.UA.ReportRequest.t(), Keyword.t()) :: :ok | {:error, term()}
@spec get_view(access_token :: String.t(), lookup_id :: String.t()) :: {:ok, google_analytics_view()} | {:ok, nil} | {:error, term()}
Returns a single Google Analytics view if the user has access to it.
@spec import_analytics(Date.Range.t(), String.t(), import_auth(), (String.t(), [map()] -> :ok)) :: :ok | {:error, term()}
Imports stats from a Google Analytics UA view to a Plausible site.
This function fetches Google Analytics reports in batches of 100000 per request. The batches are then passed to persist callback.
Requests to Google Analytics can fail, and are retried at most
5 times with an exponential backoff. Returns :ok
when
importing has finished or {:error, term()}
when a request to GA failed too
many times.
Useful links:
@spec list_views(access_token :: String.t()) :: {:ok, %{required(hostname :: String.t()) => [google_analytics_view()]}} | {:error, term()}
Lists Google Analytics views grouped by hostname.