> For the complete documentation index, see [llms.txt](https://integrations.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://integrations.impact.com/integration-guides/for-brands/tracking-integrations/javascript-tag-utt/installation.md).

# Implementing UTT

{% stepper %}
{% step %}

## Implement the Universal Tracking Tag (UTT)

Your impact.com account has a unique Universal Tracking Tag specific to your account, which needs to run globally on your site.

1. To grab your code, log into the impact.com UI and locate your unique Universal Tracking Tag snippet. From the top navigation bar, select **\[User profile] → Settings**. In the right column, go to the **Tracking** section and select **General**.
2. Copy the minified code snippet. It should look similar to below:

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

```javascript
<script>(function(a,b,c,d,e,f,g){e['ire_o']=c;e[c]=e[c]||function(){(e[c].a=e[c].a||[]).push(arguments)};f=d.createElement(b);g=d.getElementsByTagName(b)[0];f.async=1;f.src=a;g.parentNode.insertBefore(f,g);})('https://utt.impactcdn.com/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX.js','script','ire',document,window);</script>
```

{% endtab %}
{% endtabs %}

3. Place this snippet globally across your site, or in a tag manager as a custom HTML tag.

{% hint style="info" %}
**Why does the UTT need to be first?**

The UTT is required for the `identify` and `trackConversion` functions to work. If the UTT doesn't load before these, the integration can break. Make sure the UTT loads globally across your site before these two functions load.
{% endhint %}
{% endstep %}

{% step %}

## Implement the `identify` function

The `identify` function is used to identify users as accurately as possible across your site, particularly across devices. The function supplies identifiers so impact.com can map them to conversion events for attribution.

### Get & Implement `identify`

1. Copy the **entire code snippet** below.
2. Modify the snippet's values with dynamic variables. If any of the dynamic variables are unknown, pass an empty string:

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

```javascript
<script>ire('identify',{customerId:'Customer Id',customerEmail:'SHA1 Email Address',customProfileId:'UUID'});</script>
```

{% endtab %}
{% endtabs %}

* `customerId`: A visitor's unique identifier that maps to your site's backend systems.
* `customerEmail`: A SHA-1 hash of a visitor's email address.
* `customProfileId`: A unique identifier used to identify a visitor on your website, regardless of whether they're signed in. Common examples include UUIDs, anonymous user cookies, and IDFVs.

3. Add your modified code snippet to each page on your website, ensuring it fires after the UTT.

{% hint style="info" %}
**Info:** When you pass the SHA-1 hash of the visitor's email address, impact.com uses an additional HMAC-SHA-256 hash on the passed value for additional security.
{% endhint %}

### Generate a `customProfileId`

The `customProfileId` parameter enhances the UTT's `identify`, `trackConversion`, and `trackCart` functions by including an anonymous, first-party identifier from the advertiser. To generate an effective `customProfileId`, ideally a UUID, adhere to the following recommendations:

* **Non-Personal Data**: The identifier should not contain any data that could directly identify an individual, such as email addresses or authenticated user IDs. Instead, use the respective `customerEmail` (SHA1 hashed) and `customerId` fields.
* **Secure Storage Practices**: Store the identifier in a cookie with `HTTPOnly` and `Same-Site` attributes to prevent unauthorized access and enhance security against web-based attacks.
* **Alignment with Site's IP Range**: Ensure the domain issuing the cookie matches the site's IP address range, maintaining the identifier's status as a first-party element in browsers like Safari and supporting effective tracking.
  {% endstep %}

{% step %}

## Implement the `trackConversion` function

The `trackConversion` function is used on your site's order confirmation page to track the conversion data of an online sale and report it to impact.com.

1. Copy the **entire code snippet** below.
2. Replace `EVENT_TYPE_ID` with the unique Event Type ID for the action you track. To find it, select **\[User profile] → Settings** from the top navigation bar, then on the right, under **Tracking**, select **Event Types**. To learn more about Event Types and how to create them, you can follow this [guide](https://help.impact.com/brand/what-would-you-like-to-learn-about/platform-features/event-types/create-an-event-type).
3. Modify the snippet's values with dynamic variables (all variables are required):

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

```javascript
<script>
  ire('trackConversion', EVENT_TYPE_ID, {
    orderId: "Order Id here",
    customProfileId: "UUID here",
    customerId: "Customer Id here",
    customerEmail: "SHA1 Hash of Customer's Email",
    customerStatus: "Customer Status here",
    currencyCode: "USD",
    orderPromoCode: "Promo Code here",
    orderDiscount: 15.00,
    items: [
      {
        subTotal: 28.00,
        category: "Product Category 1",
        sku: "sku-11111",
        quantity: 2,
        name: "Product Name 1"
      },
      {
        subTotal: 99.00,
        category: "Product Category 2",
        sku: "sku-22222",
        quantity: 3,
        name: "Product Name 2"
      }
    ]
  }, {
    verifySiteDefinitionMatch: true
  });
</script>
```

{% endtab %}
{% endtabs %}

4. Add your modified code snippet to the order confirmation page of your site, ensuring it fires after the data layer and UTT have loaded.

That completes the tag setup. For every supported field, see [`trackConversion` parameter definitions](#trackconversion-parameter-definitions) below; for a full working example, see the [`trackConversion` example payload](#trackconversion-example-payload) below.
{% endstep %}
{% endstepper %}

## `trackConversion` parameter definitions

The table below lists a range of supported parameters that the `trackConversion` function supports. Parameters should be passed a value from your site using dynamic variables when a conversion occurs. Do not pass additional variables without first consulting the impact.com Technical Services team.

| Parameter              | Description                                                                                                                                                                                                                                                                | Data Type          |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
| `orderId`              | Unique order identifier your platform assigns to orders.                                                                                                                                                                                                                   | `ALPHANUMERIC(64)` |
| `customProfileId`      | Unique identifier used to identify a visitor on your website. `CustomProfileId` must contain a minimum of 7 characters, with at least 3 distinct characters, no embedded spaces, and mustn't be "undefined", "unknown", or "null". Omit the parameter if there's no value. | `STRING(70)`       |
| `customerId`           | Unique customer identifier your platform assigns to customer accounts. Do not use personally identifiable data for this field. Pass an empty string if unavailable.                                                                                                        | `STRING(255)`      |
| `customerEmail`        | SHA-1 hash of the customer's email address. Pass an empty string if unavailable.                                                                                                                                                                                           | `STRING(255)`      |
| `customerStatus`       | Submit values of either New or Existing. Can be configured to alter payouts.                                                                                                                                                                                               | `ALPHANUMERIC(40)` |
| `currencyCode`         | Three-letter ISO 4217 code for the currency of your platform.                                                                                                                                                                                                              | `STRING(3)`        |
| `orderPromoCode`       | Promotional (or coupon) code applied to the order. Pass an empty string if unavailable.                                                                                                                                                                                    | `STRING(64)`       |
| `orderDiscount`        | Total discount amount on the order. This will be subtracted proportionally from the item-level subtotals when revenue values are calculated by impact.com.                                                                                                                 | `DECIMAL(8,2)`     |
| `subTotal`             | SKU set subtotal of the line item (pre-tax, pre-shipping, pre-discount).                                                                                                                                                                                                   | `DECIMAL(8,2)`     |
| `category`             | Item category identifier. Can be configured to alter payouts.                                                                                                                                                                                                              | `STRING(64)`       |
| `sku`                  | Item stock-keeping unit (SKU) identifier.                                                                                                                                                                                                                                  | `ALPHANUMERIC(40)` |
| `quantity`             | Item quantity.                                                                                                                                                                                                                                                             | `INTEGER`          |
| `name`                 | Item name.                                                                                                                                                                                                                                                                 | `STRING(128)`      |
| `text1`–`text25`       | Custom text metadata for the line item.                                                                                                                                                                                                                                    | `STRING(200)`      |
| `numeric1`–`numeric10` | Custom numeric metadata for the line item.                                                                                                                                                                                                                                 | `DECIMAL(8,2)`     |
| `date1`–`date10`       | Custom date metadata for the line item.                                                                                                                                                                                                                                    | `STRING`           |
| `money1`–`money3`      | Custom monetary metadata for the line item.                                                                                                                                                                                                                                | `DECIMAL(8,2)`     |

## `trackConversion` example payload

See the example payload of a tracked conversion:

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

```javascript
<script type="text/javascript">
  ire('trackConversion', ${eventId}, {
    orderId: "1234567",
    customProfileId: "Custom Profile ID here",
    customerId: "Customer Id here",
    customerEmail: "SHA1 Hash of Customer's Email",
    customerStatus: "New",
    currencyCode: "USD",
    orderPromoCode: "ACME",
    orderDiscount: 15.00,
    items: [
      {
        subTotal: 28.00,
        category: "Product Category 1",
        sku: "sku-11111",
        quantity: 2,
        name: "Football",
        text1: "Gift-wrapped",
        text2: "Size: Medium"
      },
      {
        subTotal: 99.00,
        category: "Product Category 2",
        sku: "sku-11112",
        quantity: 3,
        name: "Men's Jersey"
      }
    ]
  },
  {
    verifySiteDefinitionMatch:true
  }
  );
</script>
```

{% endtab %}
{% endtabs %}

### Notes

* There are two (2) Footballs being purchased at a unit price of 14.00 which is a SKU set subtotal of 28.00.
* There are also three (3) Men's Jerseys being purchased at a unit price of 33.00 each for a SKU set subtotal of 99.00.
* impact.com will take the 15.00 discount passed and apply that proportionately to all items in the purchase.

Once you have fully implemented the impact.com UTT, 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
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://integrations.impact.com/integration-guides/for-brands/tracking-integrations/javascript-tag-utt/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
