> ## Documentation Index
> Fetch the complete documentation index at: https://developers.everflow.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Conversion Tracking

> Fire conversion events with the Everflow JavaScript SDK.

The `EF.conversion()` method fires a conversion event and returns a Promise that resolves with both the conversion ID and transaction ID.

## Basic Usage

```javascript theme={null}
EF.conversion({
  offer_id: 1
});
```

## Parameters

| Parameter            | Type    | Required                            | Description                                                                                                                         |
| -------------------- | ------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `offer_id`           | integer | One of `offer_id` or `aid` required | The offer identifier                                                                                                                |
| `aid`                | integer | One of `offer_id` or `aid` required | The advertiser identifier                                                                                                           |
| `transaction_id`     | string  | No                                  | Everflow transaction ID (improves attribution accuracy)                                                                             |
| `amount`             | number  | No                                  | Sale amount (for Revenue Per Sale offers)                                                                                           |
| `event_id`           | integer | No                                  | Event identifier for post-conversion events                                                                                         |
| `adv_event_id`       | integer | No                                  | Global advertiser event identifier                                                                                                  |
| `coupon_code`        | string  | No                                  | Promotional code                                                                                                                    |
| `order_id`           | string  | No                                  | Order reference ID                                                                                                                  |
| `user_id`            | string  | No                                  | User tracking identifier                                                                                                            |
| `verification_token` | string  | No                                  | Required if advertiser uses verification tokens                                                                                     |
| `email`              | string  | No                                  | Contact email                                                                                                                       |
| `sub1` – `sub10`     | string  | No                                  | Affiliate sub-placement values (typically set on the click, but accepted here too)                                                  |
| `adv1` – `adv10`     | string  | No                                  | Advertiser placement values                                                                                                         |
| `tracking_domain`    | string  | No                                  | Tracking domain override (for multi-tenant setups — see [Configuration](/sdk/configuration#multi-account-tracking-tracking_domain)) |
| `parameters`         | object  | No                                  | Free-form custom key–value parameters                                                                                               |

<Note>
  **Attribution fallback**: when `transaction_id` is not supplied, the SDK attempts to locate it automatically by checking — in order — (1) the first-party cookie on the current page's domain, then (2) the third-party cookie on the tracking domain. Passing `transaction_id` explicitly (for example, from `EF.getTransactionId(offer_id)`) is always more reliable than relying on cookie lookup.
</Note>

## Return Value

Returns a Promise resolving with an object containing `conversion_id` and `transaction_id`:

```javascript theme={null}
EF.conversion({
  offer_id: 1,
  amount: 29.99,
  event_id: 11
}).then(function(conversion) {
  console.log('Conversion ID:', conversion.conversion_id);
  console.log('Transaction ID:', conversion.transaction_id);
});
```

## Examples

**Sale conversion with amount:**

```javascript theme={null}
EF.conversion({
  offer_id: 1,
  amount: 49.99,
  order_id: 'ORD-12345',
  transaction_id: EF.getTransactionId(1)
});
```

**Post-conversion event:**

```javascript theme={null}
EF.conversion({
  offer_id: 1,
  event_id: 3,
  transaction_id: EF.getTransactionId(1)
});
```

**Using advertiser ID instead of offer ID:**

```javascript theme={null}
EF.conversion({
  aid: 2,
  amount: 9.99
});
```

**Passing currency:** the SDK sends the sale value through `amount`, but currency is not a native field. Pass it through `parameters` so it reaches the server postback (for example, when the advertiser converts the amount to the offer's default currency):

```javascript theme={null}
EF.conversion({
  aid: 2,
  amount: 100,
  parameters: {
    currency: 'USD'
  }
});
```

Use the standard three-letter currency code (`USD`, `EUR`, etc.).

**Passing a timestamp:** conversion timestamps aren't supported natively. Pass a UNIX timestamp through `parameters`:

```javascript theme={null}
EF.conversion({
  offer_id: 1,
  transaction_id: EF.getTransactionId(1),
  parameters: {
    timestamp: UNIX_TIMESTAMP
  }
});
```
