Google Analytics request object thread safe?

103 views Asked by At

I'm using this request object when reading GA data from .NET. The plan is to create the request in a static constructor for usage in an ASP.NET web page as a static member - to save time. I do not mind that the certificate stays in memory.

The embedded X509Certificate2 should be thread safe under these conditions (used in a static condition). But I can't seem to find any reference about the GA request object.

It works in test setups but I need to be sure this is by design. Anyone knows?

Thanks.

1

There are 1 answers

0
Werner On

The AnalyticsService which creates the Request object implements IDisposable. And since information is sparse, it might suggest that it wasn't intended for static usage. Instead I chose to reuse the BaseClientService.Initializer and make that static instead (one of its dependencies is the certificate). This construct performs well and now the wait time is 99% done in the GA API invocation (as it should).

Thanks.