View Source Plausible.Google.Api (Plausible v0.0.1)
Link to this section 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.
Link to this section Types
Link to this section Functions
@spec fetch_and_persist( Plausible.Site.t(), Plausible.Google.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(Plausible.Site.t(), Date.Range.t(), String.t(), import_auth()) :: :ok | {:error, term()}
Imports stats from a Google Analytics UA view to a Plausible site.
This function fetches Google Analytics reports in batches of 7500 per
request. The batches are then buffered to Clickhouse by the
Plausible.Google.Buffer
process.
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.