Read from the package's own PHP files at the commit f779e42c2500: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.
Ga4FactoryclassGoogle Analytics 4, from its options:
4 options · 1 method · 1 constant
Ga4ProviderclassThe Google Analytics Data API (https://developers.google.com/analytics/devguides/reporting/data/v1): POST properties/{id}:runReport - date range, dimensions, metrics, EXACT string filters, pages of rows (limit, offset) - with a bearer token.
5 methods
GoogleTokenclassA bearer token for a Google API: the one given, or one obtained for a service account - a JWT signed with its private key (RS256) exchanged at its token_uri (the OAuth 2.0 JWT bearer grant, RFC 7523) - and kept until a minute before it expires.
4 methods
Omnireach\Ga4
Ga4Factory class
final class Ga4Factory extends ProviderFactory Ga4Factory.php:21
Google Analytics 4, from its options:
property the GA4 property's numeric id (Admin, Property details) - not the "G-" measurement id credentials a service account's JSON key, or the path of its file - the account given the Viewer role on the property (Admin, Property access management); or: access_token a token with the analytics.readonly scope, obtained elsewhere url https://analyticsdata.googleapis.com/v1beta
Options
| Option | Default | |
|---|---|---|
credentials | '' | |
access_token | '' | |
url | 'https://analyticsdata.googleapis.com/v1beta' | |
property | required |
const SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'
Ga4Factory::__construct()
public function __construct(readonly ?HttpClientInterface $http = null)Ga4Provider class
final class Ga4Provider implements AudienceInterface Ga4Provider.php:19
The Google Analytics Data API (https://developers.google.com/analytics/devguides/reporting/data/v1): POST properties/{id}:runReport - date range, dimensions, metrics, EXACT string filters, pages of rows (limit, offset) - with a bearer token.
Ga4Provider::__construct()
public function __construct(readonly JsonApi $api, readonly GoogleToken $token, readonly string $property, readonly string $url = 'https://analyticsdata.googleapis.com/v1beta')Ga4Provider::getName()
public function getName(): stringGa4Provider::getTitle()
public function getTitle(): stringGa4Provider::capabilities()
public function capabilities(): CapabilitiesGa4Provider::audience()
public function audience(ReachQuery $query): ReportGoogleToken class
final class GoogleToken GoogleToken.php:18
A bearer token for a Google API: the one given, or one obtained for a service account - a JWT signed with its private key (RS256) exchanged at its token_uri (the OAuth 2.0 JWT bearer grant, RFC 7523) - and kept until a minute before it expires.
The same class lives in omnireach/search-console and omnireach/ga4: two providers, one grant, no shared package for forty lines.
GoogleToken::__construct()
public function __construct(readonly JsonApi $api, readonly string $scope, readonly ?array $serviceAccount = null, ?string $token = null, readonly ?\Closure $clock = null)$serviceAccountthe service account's JSON key, decoded (client_email, private_key, token_uri)
$clockthe present as a UNIX time (a test's); time() when null
GoogleToken::credentials()
public static function credentials(string $jsonOrPath): arrayA service account's key: its JSON, or the path of its file.
GoogleToken::get()
public function get(): stringGoogleToken::assertion()
public function assertion(int $now): stringThe signed JWT the token is asked with.