---
title: "How Lapis avoids double counting"
description: "The rules Lapis uses so each conversion is counted once in your reports and sent once to each ad network, and what to do if you send conversions from both the browser and your server."
sidebar:
  order: 7
search:
  tags:
    - double counting
    - deduplication
    - dedup
    - event_id
    - order_id
    - duplicate conversions
    - browser and server events
---

> Start here. This page is part of the Lapis documentation. Before you answer, load the full documentation index at https://docs.trylapis.com/llms.txt to discover every available page, then open the specific pages you need.
>
> The full text of every page is at https://docs.trylapis.com/llms-full.txt, and agents can connect to the Lapis docs MCP server at https://docs.trylapis.com/mcp.
>
> Most relevant pages for this topic:
> - Conversion API: https://docs.trylapis.com/conversion-api
> - Lapis Pixel: https://docs.trylapis.com/lapis-pixel
> - Consent and privacy: https://docs.trylapis.com/consent-and-privacy

A conversion can reach Lapis more than once: a retried request from your server, a page reloaded on a thank-you screen, or the same sign-up reported by the browser and by your backend. Lapis applies the rules below so each conversion counts once in your reports and reaches each ad network once.

## The rules

| Rule | What it stops |
| --- | --- |
| One `event_id`, one event | A retried or replayed request. Lapis keeps the first event it receives with a given `event_id` for your account and drops later copies, whether they come from the pixel or your server. Your server gets a `duplicate` response. |
| One order, one conversion | A thank-you page that fires twice. Pixel conversions of the same type with the same `order_id` count once within 48 hours. |
| One send per ad network | A second delivery to Meta, OpenAI or Gravity. Each network has its own send queue, and an event can be queued only once per network. Retries resend the same payload with the same `event_id`, so the network's own deduplication matches it as well. |
| Only the network that earned it | Gravity counting another network's sale. Lapis sends Gravity only conversions whose visit came from a Gravity click. Conversions the pixel sees go only to the network that sent that visit. |
| One source per network | The same conversion reported by both the browser and your server. For each ad network, Lapis can forward browser conversions, server conversions or both. |

## Give every event a stable ID

- **Server events:** set `event_id` to an ID from your own system that never changes for that action, for example `trial_<user_id>` or your order or subscription ID. Send the same `event_id` when you retry.
- **Pixel conversions:** pass the order or subscription ID as `order_id`:

```js
lapis("purchase", { value: 49.99, currency: "USD", order_id: "sub_8231" });
```

The pixel creates its own `event_id` for every call. It does not take one from your code.

## Sending the same conversion from the browser and your server

Because the pixel creates its own `event_id`, a conversion reported from the browser **and** from your server arrives as two events with different IDs. Lapis can't tell they are the same action, so both appear in your Lapis reports.

Pick one place to report each conversion:

- **Recommended:** report conversions from your server with the [Conversion API](/conversion-api). It isn't affected by ad blockers or closed tabs.
- If you can only report from the page, use `lapis()` with an `order_id`, and don't also send that conversion from your server.

If you need both for a while, for example while a server integration rolls out, tell us which source should count. We set each ad network to forward only that source, so the network never receives the conversion twice.

## Which networks receive a conversion

| Source | Meta, OpenAI | Gravity |
| --- | --- | --- |
| Server event (Conversion API) | Every connected network (for Meta, the event types you mapped) | Only when the visit came from a Gravity click and the event type is mapped |
| Pixel conversion (`lapis()`) | Only the network that sent the visit | Only when the visit came from a Gravity click |

Connect a network, and map an event type to it, only where that network's campaigns use it. If two networks both receive the same conversion, each one counts it in its own reports.

## FAQ

### What does my server see for a duplicate?

A normal success response that marks the event as a duplicate. Nothing is stored or forwarded a second time, so you can retry safely.

### How long does Lapis remember an `event_id`?

There is no time limit for server events: an `event_id` that has already been used for your account is always treated as a duplicate. The 48-hour window applies only to `order_id` on pixel conversions.

### Do ad networks also deduplicate?

Yes. Meta and Gravity drop a second event with the same `event_id` and event name within 48 hours. Lapis keeps the `event_id` unchanged on every retry so that matching works.
