Setting timeout and withCredentials parameters

Hi

Is it possible to set timeout and withCredentials parameter in snowplow tracker configuration while we initialize it ? I am using javascript tracker 2.14.0 version. Event method is “post”.

Thanks and Regards
Amandeep Singh

Hi @Amandeep_Singh,

No, these aren’t configurable. withCredentials is always set to true. Timeout is hardcoded to be 5 seconds. Events are kept in storage if they don’t succeed, and will be re-attempted along with the next event.

We haven’t so far come across a real need to make these configurable, but if there’s a compelling argument we’re always willing to listen?

Best,

1 Like

Hi @Colm

Reasons for configuring timeout parameter are as follows:

  • Request is getting cancelled in browser when page is taking time to load(either because of slow internet connection or page is loaded for the first time).Someone in the past has already raised issue for this in snowplow github as well as snowplow discourse (Add possibility to set timeout).

  • Performing business logic when POST request hits application server. I know architecturally performing business logic in request-response cycle is not good. I am myself using celery to perform business logic in background. I just save the POST data and return response. Still i think there has to be possibility for this otherwise request will always get cancelled if applying business logic and sending response takes more than 5 seconds.

Reason for configuring “withCredentials” parameter is as follows

  • I am talking about case when tracker is deployed on third party websites. Right now in order to make POST request successful i can send only one origin value in “Access-Control-Allow-Origin” header when repsonding to preflight OPTIONS request. Now suppose i want to make my tracking code to have same collector url but it can be used on multiple third party website(setting app id different for each website so that i can identify visitors ).In that case i have to pass ‘*’ (wildcard) in “Access-Control-Allow-Origin” header. This is not possible when “withCredentials” set to true.

I hope i have made my points clear. In case you would still like to know anything further then please let me know. I really appreciate your efforts for helping me out.

Thanks and Regards
Amandeep Singh

1 Like

Thanks @Amandeep_Singh for the detailed explanation. Sorry for the delay in responding - things picked up for me and I haven’t had time for the forum.

I’ve recorded those details in an issue, so that the team can consider them as feature requests. :slight_smile:

1 Like

Hi @Colm

Don’t be sorry. I can understand. Everyone is busy working from home due to corona crisis. Thanks for creating feature request. I appreciate your efforts.

Regards
Amandeep Singh