# Implementation

The exact method in which you implement server-side API calls to impact.com on your site is up to your discretion and specific requirements. This page describes what you'll need to do and keep in mind when implementing.

{% hint style="warning" %}
**Important:** This integration requires a skilled web developer comfortable with JavaScript, HTML, tag managers, and browser developer tools to configure, implement, and test. Before continuing, *make sure you are logged in* to [impact.com](https://www.impact.com/).
{% endhint %}

impact.com also **strongly recommends** implementing an intelligent retry functionality for API calls that may fail. Any call that results in a `5XX` response code should be retried automatically.

## Check before integrating

impact.com will complete several integration steps on your behalf. Check with your implementation engineer to ensure that the following configuration steps have been completed: *Event Type*, *Gateway Tracking*, *General Tracking*.

## Capture & Store `im_ref`

* impact.com will dynamically populate an `im_ref` value in your landing page URL (e.g. `https://www.example.com/store/product1?im_ref=1234567`) when visitors are directed to your site from an impact.com tracking link. The query string parameter name is `im_ref`.
* The `im_ref` value should be captured and stored in the browser (e.g., in a first-party cookie) and available if the same visitor returns directly to your site in another session.
* If, during the customer journey, the website URL changes from one domain to another, the stored `im_ref` value should be passed and stored under the new domain.

## Report conversions to the `/Conversions/` endpoint

When a conversion event occurs, you’ll need to make a server-side API call to the `/Conversions/` endpoint with conversion data. When impact.com receives this data, attribution for the conversion is determined and awarded to a partner, making it a new pending action.

{% hint style="success" %}
**Note:** Refer to the [full endpoint documentation](https://integrations.impact.com/impact-brand/reference/conversions-model) to see code examples, parameter definitions, and more.
{% endhint %}

### Example call

In the example below:

* There are two (2) Product Name 1 items being purchased at a unit price of 14.00 each for a SKU set subtotal of 28.00.
* There are three (3) Product Name 2 items being purchased at a unit price of 33.00 each for a SKU set subtotal of 99.00.
* impact.com will take the $15 discount passed and apply that proportionately to all items in the purchase.

A `/Conversions/` call can be customized based on your specific requirements — refer to the full endpoint documentation to learn about additional parameters.

{% tabs %}
{% tab title="cURL" %}

```bash
curl ‘https://api.impact.com/Advertisers/<AccountSID>/Conversions’ \
  -X POST \
  -u ‘<AccountSID>:<AuthToken>’ \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \ 
  -d ‘CampaignId=1000’ \
  -d ‘EventTypeId=9876’ \
  -d ‘EventDate=2024-08-01T23:55:24-08:00’ \
  -d ‘ClickId=QiiWXOVnrQ3SQHl24jQjyxBGUkmzfJ3i1VHrWM0’ \
  -d ‘CustomerId=BCZ2WVSH674563PDPYOTM3AXDQ’ \
  -d ‘CurrencyCode=USD’ \
  -d ‘OrderId=O1234567’ \
  -d ‘OrderDiscount=15.00’ \
  -d ‘OrderPromoCode=15BUCKSOFF' \
  -d ‘ItemSku1=1ABC2345' \
  -d ‘ItemName1=Product Name 1’ \
  -d ‘ItemCategory1=Hardware’ \
  -d ‘ItemQuantity1=2' \
  -d ‘ItemSubTotal1=28.00’ \
  -d ‘ItemSku2=9ZXY7654’ \
  -d ‘ItemName2=Product Name 2’ \
  -d ‘ItemCategory2=Gardening’ \
  -d ‘ItemQuantity2=3’ \
  -d ‘ItemSubTotal2=99.00’
```

{% endtab %}
{% endtabs %}

### End-to-End Testing

Once the impact.com app is fully installed, you can begin end-to-end testing to ensure everything is working properly. Learn how to proceed with [End-to-End Testing](/integration-guides/end-to-end-tests.md).


---

# Agent Instructions: 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:

```
GET https://integrations.impact.com/integration-guides/for-brands/tracking-integrations/api-online-sale/implementation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
