node-tracker.emitterconfigurationbase
Home > @snowplow/node-tracker > EmitterConfigurationBase
EmitterConfigurationBase interface
Signature:interface EmitterConfigurationBase
Properties
Property | Type | Description |
---|---|---|
bufferSize? | number | (Optional) The amount of events that should be buffered before sending Recommended to leave as 1 to reduce change of losing events |
connectionTimeout? | number | (Optional) How long to wait before aborting requests to the collector |
credentials? | "omit" | "same-origin" | "include" | (Optional) Controls whether or not the browser sends credentials (defaults to 'include') |
customFetch? | (input: Request, options?: RequestInit) => Promise<Response> | (Optional) Enables overriding the default fetch function with a custom implementation. |
customHeaders? | Record<string, string> | (Optional) An object of key value pairs which represent headers to attach when sending a POST request, only works for POST |
dontRetryStatusCodes? | number[] | (Optional) List of HTTP response status codes for which events sent to Collector should not be retried in future request. Only non-success status codes are considered (greater or equal to 300). The don't retry codes are only considered for GET and POST requests. By default, the tracker retries on all non-success status codes except for 400, 401, 403, 410, and 422 (these don't retry codes will remain even if you set your own dontRetryStatusCodes but can be changed using the retryStatusCodes ). |
eventMethod? | EventMethod | (Optional) The preferred technique to use to send events |
eventStore? | EventStore | (Optional) Enables providing a custom EventStore implementation to store events before sending them to the collector. |
idService? | string | (Optional) Id service full URL. This URL will be added to the queue and will be called using a GET method. This option is there to allow the service URL to be called in order to set any required identifiers e.g. extra cookies.The request respects the anonymousTracking option, including the SP-Anonymous header if needed, and any additional custom headers from the customHeaders option. |
keepalive? | boolean | (Optional) Indicates that the request should be allowed to outlive the webpage that initiated it. Enables collector requests to complete even if the page is closed or navigated away from. Note: Browsers put a limit on keepalive requests of 64KB. In case of multiple keepalive requests in parallel (may happen in case of multiple trackers), the limit is shared. |
maxGetBytes? | number | (Optional) The max size a GET request (its complete URL) can be. Requests over this size will be tried as a POST request. |
maxPostBytes? | number | (Optional) The max size a POST request can be before the tracker will force send it Also dictates the max size of a POST request before a batch of events is split into multiple requests |
onRequestFailure? | (data: RequestFailure, response?: Response) => void | (Optional) A callback function to be executed whenever a request fails to be sent to the collector. This is the inverse of the onRequestSuccess callback, so any non 2xx status code will trigger this callback. |
onRequestSuccess? | (data: EventBatch, response: Response) => void | (Optional) A callback function to be executed whenever a request is successfully sent to the collector. In practice this means any request which returns a 2xx status code will trigger this callback. |
postPath? | string | (Optional) The post path which events will be sent to. Ensure your collector is configured to accept events on this post path |
retryFailedRequests? | boolean | (Optional) Whether to retry failed requests to the collector.Failed requests are requests that failed due to [timeouts](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout\_event), [network errors](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/error\_event), and [abort events](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/abort\_event).Takes precedent over retryStatusCodes and dontRetryStatusCodes . |
retryStatusCodes? | number[] | (Optional) List of HTTP response status codes for which events sent to Collector should be retried in future requests. Only non-success status codes are considered (greater or equal to 300). The retry codes are only considered for GET and POST requests. They take priority over the dontRetryStatusCodes option. By default, the tracker retries on all non-success status codes except for 400, 401, 403, 410, and 422. |
useStm? | boolean | (Optional) Should the Sent Timestamp be attached to events. Only applies for GET events. |