snowplow/snowplow-javascript-tracker

View on GitHub
api-docs/docs/node-tracker/markdown/node-tracker.gotemitter.md

Summary

Maintainability
Test Coverage
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@snowplow/node-tracker](./node-tracker.md) &gt; [gotEmitter](./node-tracker.gotemitter.md)

## gotEmitter() function

Create an emitter object, which uses the `got` library, that will send events to a collector

<b>Signature:</b>

```typescript
declare function gotEmitter(endpoint: string, protocol?: HttpProtocol, port?: number, method?: HttpMethod, bufferSize?: number, retry?: number | Partial<RequiredRetryOptions>, cookieJar?: PromiseCookieJar | ToughCookieJar, callback?: (error?: RequestError, response?: Response<string>) => void, agents?: Agents, serverAnonymization?: boolean): Emitter;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  endpoint | string | The collector to which events will be sent |
|  protocol | HttpProtocol | http or https |
|  port | number | The port for requests to use |
|  method | HttpMethod | get or post |
|  bufferSize | number | Number of events which can be queued before flush is called |
|  retry | number \| Partial&lt;RequiredRetryOptions&gt; | Configure the retry policy for <code>got</code> - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#retry |
|  cookieJar | PromiseCookieJar \| ToughCookieJar | Add a cookieJar to <code>got</code> - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#cookiejar |
|  callback | (error?: RequestError, response?: Response&lt;string&gt;) =&gt; void | Callback called after a <code>got</code> request following retries - called with ErrorRequest (https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#errors) and Response (https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#response) |
|  agents | Agents | Set new http.Agent and https.Agent objects on <code>got</code> requests - https://github.com/sindresorhus/got/blob/v11.5.2/readme.md\#agent |
|  serverAnonymization | boolean | If the request should undergo server anonymization. |

<b>Returns:</b>

Emitter