<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/analytics](./analytics.md) &gt; [logEvent](./analytics.logevent_9.md)

## logEvent() function

Sends analytics event with given `eventParams`<!-- -->. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the gtag.js reference documentation](https://developers.google.com/gtagjs/reference/event)<!-- -->.

<b>Signature:</b>

```typescript
export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: {
    value?: EventParams['value'];
    currency?: EventParams['currency'];
    transaction_id: EventParams['transaction_id'];
    tax?: EventParams['tax'];
    shipping?: EventParams['shipping'];
    items?: EventParams['items'];
    coupon?: EventParams['coupon'];
    affiliation?: EventParams['affiliation'];
    [key: string]: any;
}, options?: AnalyticsCallOptions): void;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  analyticsInstance | [Analytics](./analytics.analytics.md) |  |
|  eventName | 'purchase' \| 'refund' |  |
|  eventParams | { value?: [EventParams](./analytics.eventparams.md)<!-- -->\['value'\]; currency?: [EventParams](./analytics.eventparams.md)<!-- -->\['currency'\]; transaction\_id: [EventParams](./analytics.eventparams.md)<!-- -->\['transaction\_id'\]; tax?: [EventParams](./analytics.eventparams.md)<!-- -->\['tax'\]; shipping?: [EventParams](./analytics.eventparams.md)<!-- -->\['shipping'\]; items?: [EventParams](./analytics.eventparams.md)<!-- -->\['items'\]; coupon?: [EventParams](./analytics.eventparams.md)<!-- -->\['coupon'\]; affiliation?: [EventParams](./analytics.eventparams.md)<!-- -->\['affiliation'\]; \[key: string\]: any; } |  |
|  options | [AnalyticsCallOptions](./analytics.analyticscalloptions.md) |  |

<b>Returns:</b>

void

