Period::days date range returns unexpected results from Analytics #530
MaxKorlaar
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're using the
get()
method withPeriod::days(1)
to retrieve data from Analytics, and we offset thestartDate
andendDate
manually depending on how far back we'd like to go. It seems that the data returned by Google Analytics does not seem to account for the fact that these dates contain time as well, as all results return the views for both the start date and the complete end date, as opposed to only containing the views for the start date (starting at 00:00:00) and up to the views at the beginning of the end date (also at 00:00:00).It seems that Google Analytics interprets this request as a request for the metrics for both the start date and the end date, and thus returns the data for both dates combined. Our solution is to manually override the
endDate
and setting it to the end of thestartDate
(eg. by using Carbon'sendOfDay()
).I'd like to know whether this issue is specific to our use case only as we need the date to be precise per day only, or if the Period class or perhaps the
get()
method should be updated to reflect this discrepancy in what Google Analytics seems to expect.Beta Was this translation helpful? Give feedback.
All reactions