I am reading the analytics data using API call found in this link Google Analytics Data API (GA4) What is the google delay to return all the info? for example, at 5 Am can I be sure I am receiving all the info regarding yesterday? following is the piece of code I send the request to Google. offset is 0 and limit is 10000. Since I want to read the info related to each date separately start date and end date are the same.
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -1);
String yesterday=dateFormat.format(calendar.getTime());
RunReportRequest request =
RunReportRequest.newBuilder()
.setProperty("properties/" + propertyId)
.addDateRanges(DateRange.newBuilder().setStartDate(yesterday).setEndDate(yesterday))
.addDimensions(Dimension.newBuilder().setName("date"))
.addDimensions(Dimension.newBuilder().setName("eventName"))
.addDimensions(Dimension.newBuilder().setName("fullPageUrl"))
.addMetrics(Metric.newBuilder().setName("eventCount"))
.addMetrics(Metric.newBuilder().setName("eventsPerSession"))
.addMetrics(Metric.newBuilder().setName("eventValue"))
.setOffset(offset)
.setLimit(limit)
.build();
The Google analytics data api has the same limitations as to when data has completed processing as the old Google analytics reporting api for UA.
The main difference is that with the old reporting api we could see that processing was complete by checking the is golden field.
Unfortunately I have been informed by the google analytics api team that there is no plans at this time to add an is golden option to the Google analytics data api response for GA4.
Because of this I always ensure that I give enough time for data to have completed processing before I request data from the api.
if you check the data freshness chart
It says that for all reports everything should be processed in 12 hours but it will depend greatly on the size of the properly. That being how many its your account is getting. If its a large account it could take more then 24 hours.
So how long you should weight will greatly depend upon how must data you have. Only you can decide. If its a big account with millions of hits a day i would go with the old 24 – 48 hour rule.
You could ofcouse just run a few tests. Check the data now store it and see what you get in two days if the data is the same then you will know your account processes faster then the 24 – 48 hour.
4ryspu