runRealtimeReport method
- RunRealtimeReportRequest request,
- String property, {
- String? $fields,
Returns a customized report of realtime event data for your property.
Events appear in realtime reports seconds after they have been sent to the Google Analytics. Realtime reports show events and usage data for the periods of time ranging from the present moment to 30 minutes ago (up to 60 minutes for Google Analytics 360 properties). For a guide to constructing realtime requests & understanding responses, see Creating a Realtime Report.
request
- The metadata request object.
Request parameters:
property
- A Google Analytics GA4 property identifier whose events are
tracked. Specified in the URL path and not the body. To learn more, see
where to find your Property ID.
Example: properties/1234
Value must have pattern ^properties/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a RunRealtimeReportResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<RunRealtimeReportResponse> runRealtimeReport(
RunRealtimeReportRequest request,
core.String property, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1beta/' + core.Uri.encodeFull('$property') + ':runRealtimeReport';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return RunRealtimeReportResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}