> For the complete documentation index, see [llms.txt](https://docs.adpage.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.adpage.io/integrations-marketingtools/chatgpt-ads/setting-up-client-side-chatgpt-ads-tracking-with-deduplication.md).

# Setting up client-side ChatGPT Ads tracking with deduplication

Setting up client- and server-side tagging for ChatGPT Ads with event ID deduplication

Running both server-side and client-side tagging means OpenAI receives the same conversion twice: once from the browser and once from your server. Deduplication is what stops that from being counted twice. It works when both events carry the **same event name** and the **same event ID**.

OpenAI actively recommends this hybrid setup. Browser-only tracking misses conversions due to cookie restrictions and ad blockers, while the server-side event adds richer context (transaction details, CRM data) and captures the fragmented, multi-session journeys that are common with ChatGPT. Combined, they give the most accurate picture of ChatGPT Ads performance.

So the goal throughout this guide is that your OpenAI Pixel tag, your GA4 tag and your server-side OpenAI Conversions API tag all describe the same interaction with the same event ID.

### Before you start

Make sure you have:

* [ ] A working [server-side OpenAI Conversions API setup](/integrations-marketingtools/chatgpt-ads.md).
* [ ] Your **OpenAI Pixel ID**. See [Where to find the OpenAI Pixel ID and API Key](/integrations-marketingtools/chatgpt-ads/where-to-find-the-openai-pixel-id-and-api-key.md).
* [ ] A **Unique Event ID** variable in your web container.

### Step 1: Add the tag template

1. Open your GTM web container and go to **Templates**.
2. Under **Tag Templates**, click **Search Gallery**.
3. Search for the **OpenAI Pixel** tag template and add it to your workspace.

### Step 2: Create a variable for your Pixel ID

1. Go to **Variables**.
2. Create a new **User-Defined Variable** and choose **Constant** as the variable type.
3. Enter the OpenAI Pixel ID as the value and save the variable.

{% hint style="info" %}
Using a constant variable rather than typing the ID into each tag means you only have one place to change it later.
{% endhint %}

### Step 3: Create your ChatGPT event tags

1. Go to **Tags** and create a new tag. Select the **OpenAI Pixel** template as the tag configuration.
2. In the **OpenAI Pixel ID** field, select your Pixel ID variable.
3. Under **Event Name Setup Method**, choose **Inherit from DataLayer** to map GA4 events automatically, or **Override** to send a standard or custom event name. Custom event names may only contain lowercase letters, numbers, underscores and dashes, and must be 1–65 characters long.
4. Leave **Automatic Event Parameters** mapping enabled.
5. Expand **Server-Side Tracking Settings** and add your **Unique Event ID** variable in the **Event ID** field.
6. As the trigger, select the same trigger you use for the GA4 event tag covering this interaction.
7. Save the tag, and repeat for the other events and conversions you want to set up.

{% hint style="warning" %}
Don't forget to set up the page\_view tag, using the same trigger as your GA4 page\_view event tag.
{% endhint %}

### Step 4: Add the event ID to your GA4 events

Your GA4 event tags are what feed the server container, so the event ID has to travel with them. For every interaction you want to deduplicate, add your Unique Event ID variable as an `event_id` event parameter on the GA4 event tag that fires on that interaction.

### Step 5: Create an Event ID variable in your server container

1. Open your GTM server container and go to **Variables**.
2. Create a new **User-Defined Variable** that reads the incoming event's `event_id` parameter (for example an **Event Data** variable set to the key `event_id`).
3. Save the variable.

### Step 6: Add the Event ID to your server-side tag

1. Open your OpenAI Conversions API tag.
2. Expand **Server Event Data Parameters** (or the equivalent event-level override section).
3. Add a parameter with **Parameter Name** set to **Event ID**, and point its value at the Event ID variable you created in the previous step.
4. Save the tag.

### Step 7: Test and verify

Open Google Tag Manager's preview mode in both containers to check whether the event ID in the client-side OpenAI Pixel tag matches the one in the server-side OpenAI Conversions API tag. The Stape GTM Helper browser extension makes this easier to inspect. If the IDs don't match, the usual causes are:

* The event names do not match. The Pixel sends one name and the server-side tag sends another.
* The event IDs do not match, or the server-side tag receives no event ID at all.
* The two tags fire on different triggers, so they never describe the same interaction.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.adpage.io/integrations-marketingtools/chatgpt-ads/setting-up-client-side-chatgpt-ads-tracking-with-deduplication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
