Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue time on batched hits? #51

Open
mikkelrj opened this issue Apr 10, 2018 · 5 comments
Open

Queue time on batched hits? #51

mikkelrj opened this issue Apr 10, 2018 · 5 comments
Milestone

Comments

@mikkelrj
Copy link

After some experimentation with batching enabled, it seems that all hits come in at the same time point (the time of the batch request), when I really want the hits to appear at the time they were posted. This seems like a general issue with using batched requests on GA, but I have been unable to find anything about it. Any pointers would be appreciated.

Anyway, as a solution, I am considering adding the Queue Time parameter to each hit, but I can see no other way than deriving the qt value at the time when the batch request is made, which means it has to be done when building the batch request in the GoogleAnalyticsImpl.submitBatch(boolean) method. Only then is the time offset of each hit known. This requires keeping time of the batched hits.

Any thoughts or maybe consideration of implementing the option of keeping time of the hits and setting the queue time parameter automatically, when in batch mode, at the time of posting the batch request?

Thanks!

Documentation on the Queue Time parameter: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#qt

@brsanthu
Copy link
Owner

We will need to add a submitTime to GoogleAnalyticsRequest to capture time when it was submitted by the consumer. At the time of posting to GA, we need to calculate the queue time.

The issue I see here is, if a customer has already using the queue time parameter, then it will be a conflict. We could populate the queue time if it is not already populated but that will still leave the issue as is for those who are using queue time and want to batch.

@mikkelrj
Copy link
Author

mikkelrj commented Apr 11, 2018

Right. And I see the possible conflict with existing use of the queue time parameter.

I was thinking it could make sense to add a property to GoogleAnalyticsConfig (maybe autoQueueTime?) to explicitly control this behaviour. When this property is true and batchingEnabled is true then the queue time property would be calculated and set on each request at the time the batch request is posted to GA.

@brsanthu
Copy link
Owner

That makes sense. Since qt value is a milliseconds, if customers enables it (we could flag as defaults to true), then we will add to the existing value if there is one or set new.

@mikkelrj
Copy link
Author

I can maybe implement this in the weekend, unless this is something you plan to do.

brsanthu added a commit that referenced this issue May 19, 2019
brsanthu added a commit that referenced this issue May 19, 2019
@brsanthu brsanthu added this to the 2.1 milestone May 20, 2019
@brsanthu
Copy link
Owner

Added setAutoQueueTime config flag. If enabled, it adds or sets the queue time from time request created to request submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants