zwetan / as3-universal-analytics

Google Universal Analytics for AS3
Mozilla Public License 2.0
73 stars 11 forks source link

Bypassing the events throttling #15

Closed lucien144 closed 7 years ago

lucien144 commented 9 years ago

I noticed that GA throws away some events, especially the ones that are sent right after the screenView call. I assume the reason is the GA throttling limitation as these 2 calls are called right after each other - within 1 second.

Is there a way how to avoid this? I'm thinking of saving events into the array and sending these events one by one after some interval.

Thanks.

BTW. Huge thanks for making this library, really appreciate this.

zwetan commented 9 years ago

Yes by default there is a RateLimiter see TrackingDetailsAndTricks - throttling

but it should not prevent to send hit requests close to one another for example

the WebTracker starts with 20 hits that are replenished at a rate of 2 hits per second.

you can send 20 hits in a row and then the limiter will kick in if it didn't had time to replenish with more hits as described above

depending on which tracker you use the amount of hits and the time to replenish can be different but in all case you should be able to send few hits in a row.

So, I would advise to keep the limiter, because if you send way too many hit requests in a too short time you will fatally hit the hard limits imposed by GA (on the backend) see GettingStarted - limits-and-quotas

That said you can disable the RateLimiter in the Configuration

var config:Configuration = new Configuration();
      config.enableThrottling = false;

see https://github.com/zwetan/as3-universal-analytics/blob/master/src/libraries/uanalytics/tracking/Configuration.as#L139

zwetan commented 9 years ago

BTW. Huge thanks for making this library, really appreciate this.

thanks :) I thought it was needed

lucien144 commented 9 years ago

Thanks for the response. I'm actually using AppTracker in AIR app for iOS/Android. It's still weird because the number of hits when doing tests is around 10, max 20 per minute.

It looks like when I call tracker.screenview() first and right after the tracker.event(), the only tracker.screenview() gets through. If I do the opposite - calling tracker.event() first and tracker.screenview() after, the only tracker.event() gets through.

As a workaround, I'm calling the tracker.event() with 1s delay.

Do you have any idea why is this happening?

zwetan commented 9 years ago

how do you know if a hit request gets through or not ?

using the real time dashboard ?

so first be sure your property is an app property and not a web property

web property: can see page in real time app property: can see screen in real time

but you can not do both

other thing to check is how you set up the screenview TrackingDetailsAndTricks - screens

if you don't define the APP_NAME the screenview will not be a valid hit

lucien144 commented 9 years ago

Yeah, I used the realtime dashboard but even when I checked the stats the day after, events weren't there. So as a workaround I set 1s delay between all GA calls and this works like a charm...

Might this be related to https://github.com/zwetan/as3-universal-analytics/pull/16: Updated the Loader HitSenders to fix an issue when communicating simultaneous requests causes the last load operation to close. This would result in events not being communicated to analytics services.

?

Thanks.

zwetan commented 9 years ago

yes it could be related to issue #16 but I didn't tested more than that

normally a new version should be available by the end of the week integrating the #16 patch and other things so maybe retest wit this new build a little later see if it fix the problem