---
title: "Events Tracking API"
url: "https://help.productfruits.com/en/article/javascript-api-events-tracking"
language: "en"
last_updated: "2025-02-17T08:35:41.696Z"
---

# Events Tracking API

## Description

This JS API provides you access to custom events. Access methods on this object:

> `productFruits.api.events`

## Methods

> `track(eventName, attributes, options)`

Tracks a new event by its `eventName`. The event does not need to be pre-created in the Product Fruits administration. More information about custom events can be seen [here](https://help.productfruits.com/en/article/custom-events).

The `attributes` optional parameter can be used for more detailed segmentation

The `options` optional parameter can currently get a single option `forwardToIntegrations`. If you set it to true, the event will be distributed to enabled analytics integrations.

An example: 

```javascript
window.productFruits.api.events.track("EVENT NAME", {'exampleAttribute': 'example'}, {forwardToIntegrations:true})
```
