# Set up Proof Impact tracking

Create a conversion event, add the tracking code to your site and send a test, so Proof Impact can link conversions to widget views.

To start measuring with Proof Impact, create a conversion event, add the tracking code to your site and check it with a test. Proof Impact is on Premium and Business, and the workspace owner and the project's Admins set it up.

Before you start, publish the widget you want to measure: the tracking code is made for a published widget. See [Publish, update or unpublish a widget](/help/display/publish-update-or-unpublish-a-widget). For what Proof Impact measures, see [Proof Impact](/help/insights/proof-impact).

Open **Proof Impact** under **Analyze** in your project's sidebar.

1. **Create a conversion event**

   A conversion event is an action you count, such as a completed purchase. Proof Impact refuses events you haven't created, so create each one before your site sends it.

   1. Click the **Data Quality** tab, then **Add event** under **Conversion events**. (On a new project, **Add your conversion event** in the setup checklist of the **Overview** tab does the same.)
   2. Pick a template in **Start from a template**, such as **Completed purchase** or **Customer signup**, or keep **Custom event**.
   3. Check the **Event key**, the name your code sends, such as `purchase_completed`. It can't be changed later. With **Custom event**, type the key and a **Display label** yourself: **Create event** stays unavailable until both are filled in.
   4. Check the **Outcome role**. A project's first event starts as the **Primary outcome**, the one the **Overview** tab shows by default; make that your most important event.
   5. Choose a **Value policy**: whether a conversion has to carry an amount.
   6. Under **Advanced**, choose an **Attribution window** and an **Identity scope**, or keep what's there.
   7. Click **Create event**.

   [Event settings](#event-settings) lists the choices for each of these.

2. **Install the tracking code**

   Click the **Overview** tab. Until your first conversion arrives it shows a checklist, **Set up Proof Impact**; open its step **Add the code to your site**. Afterwards the same code is under **Install and test tracking**. It's ready-made for **HTML / JavaScript**, **React** and **Next.js**, filled in with your newest published widget and your primary event.

   1. Copy the code for your site, and put the widget on the pages where visitors should see your testimonials.
   2. On the page where the conversion happens, such as your order confirmation page, call `trackProofImpactConversion()` from the code after the conversion succeeds. That page must load the widget's script too, because `window.retestimonial.convert()` comes from it.
   3. Replace `order.id` with your own order or sign-up ID. If the event takes a value, replace `order.total` with the amount and `order.currency` with the order's own three-letter currency code, such as USD or EUR. The `idempotencyKey` must stay the same if the same conversion is sent twice, so it's counted once. A call without one is refused.

   If you embed widgets with the iframe code, tick **Automatic sizing and Proof Impact** under **Get code** and add its helper script to your site. Views in an iframe without the helper can't be linked to conversions.

   To send purchases from your server instead, see [Report orders from your server](#report-orders-from-your-server).

3. **Check that it works**

   In the checklist's last step (or in **Install and test tracking**), click **Send test conversion**. It checks your widget's latest view against the event and answers **Would it be matched?** It's marked **Nothing was saved** and never appears in the report.

   The test needs a view of the widget inside the event's attribution window. Without one it answers **No, it would not be matched**: open a page that shows the widget, keep it on screen for a second and test again.

   Then try it for real: open a page with the widget, scroll until the widget is on screen, and complete a conversion in the same tab. A view counts once at least half of the widget has been on screen for a second.

   The checklist marks each step done as it happens: a published widget, a primary event, the widget seen on your site with the conversion code loaded, and the first conversion. While the checklist is open it checks again about every 30 seconds, so a step done on your site ticks without a reload. With that first conversion the checklist gives way to the report.

## Event settings

| Setting                  | What it does                                                                                                                                                                                                                                                                                                                                           |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Event key**            | The name your code sends. Lowercase letters, numbers and underscores, starting with a letter, up to 64 characters. Dots may separate parts, as in `checkout.completed`. It can't be changed later.                                                                                                                                                     |
| **Display label**        | The event's name in the report.                                                                                                                                                                                                                                                                                                                        |
| **Outcome role**         | **Primary outcome** is the event the **Overview** tab shows by default and the one Auto-Optimize compares options on. Only one active event can be primary. **Secondary milestone** is a step on the way, such as a trial start. **Guardrail** is something you don't want more of, such as a refund; an experiment can watch it as its safety metric. |
| **Value policy**         | **Value required** refuses a conversion without an amount and currency. **No value expected** refuses one that has an amount. **Value optional** accepts both.                                                                                                                                                                                         |
| **Attribution window**   | How long before the conversion a widget view still counts. It starts at **4 hours**; the other choices are **1 day**, **7 days** and **30 days**.                                                                                                                                                                                                      |
| **Identity scope**       | Leave it on **Same-tab session** unless you need **Consented journey**. See [Privacy](/help/insights/proof-impact#privacy).                                                                                                                                                                                                                            |
| **Include in reporting** | On unless you switch it off. An event with it off still receives conversions, but stays out of the report's totals, and experiments and Auto-Optimize can't use it.                                                                                                                                                                                    |

To change these later, see [Change an event later](/help/insights/read-the-proof-impact-report#change-an-event-later).

## Report orders from your server

If an order is final only once your server says so, for example after a payment webhook, send it from your server instead of the browser. A refund or a cancellation you send later then corrects the order's value.

To send purchases from your server, create a server key in the **Developer** tab of your [project settings](/help/account/project-settings). **Server keys and signed example**, under the tracking code in Proof Impact, goes there. The example on that tab has two parts: your checkout page asks for a token for the order, and your server sends that token with the order, so the order is linked to the proof its buyer saw.

The tab opens on **Tracking**. Under **Server keys**, click **Create key** and give the key a name. The key is shown once, so copy it before you close the window. The example appears once the project has an active event whose **Value policy** is **Value optional** or **Value required**.

**Tracking** also shows the `convert()` call for each of your events under **Recording a conversion**, and holds the tracking settings described under [Privacy](/help/insights/proof-impact#privacy).

## What happens next

Proof Impact matches new conversions to widget views every minute. If nothing shows up, see [Proof Impact shows no data or unmatched conversions](/help/insights/proof-impact-not-measuring).

- [Read the Proof Impact report](/help/insights/read-the-proof-impact-report)
- [Run a Proof Impact experiment with a no-widget group](/help/insights/run-a-proof-impact-experiment)
- [Auto-Optimize a Proof Match widget](/help/insights/auto-optimize-a-proof-match-widget)
- [Embed a widget on any website](/help/display/embed-a-widget-on-any-website)
