> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/activate/event-streaming/destinations/attribution-and-affiliate/shopmy.md).

# ShopMy

ShopMy is an affiliate marketing platform for creator partnerships. This destination loads the ShopMy affiliate click-tracking script in the browser. It sends order confirmations to ShopMy when a visitor was referred by a ShopMy affiliate or used a creator's discount code. No credentials are required. ShopMy attribution is based on cookies set by the click-tracking script and on discount codes on the order.

## Getting started

The ShopMy click-tracking script loads automatically, and you don't need any credentials.

## Settings

* **Destination Name** (required): a name to tell this destination apart.
* **Consent Requirements** (optional): the consent categories a visitor must accept before Chord sends data to this destination. See [Consent](/activate/event-streaming/consent.md).

## Connect

Add **ShopMy** from the destination catalog, using the settings above. See [Connect a destination](/activate/event-streaming/connect-a-destination.md) for the full steps.

## Event mapping

| Chord event                                                         | ShopMy event                                        | Notes                                                                                                       |
| ------------------------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `page`                                                              | Loads click-tracking script                         | No data forwarded                                                                                           |
| [`Order Completed`](/collect-data/tracking-plan/order-completed.md) | `POST https://api.shopmy.us/api/order_confirmation` | Fired if the `sms_click_id` cookie **or** a discount code is present. Skipped if the order has no products. |

All other events are skipped. Page and identify events do not send data to ShopMy. They only trigger the script to load.

## Page events

Loads the ShopMy click-tracking script. No data is sent to ShopMy. The script manages affiliate attribution cookies (`sms_click_id`) by itself.

## Order Completed

Sends an order confirmation to the ShopMy API. The event is skipped if the order has no products. It is also skipped if **neither** an `sms_click_id` cookie **nor** a discount code is present. This way orders are reported for both click-based attribution (affiliate link) and code-based attribution (creator discount code).

**API call:** `POST https://api.shopmy.us/api/order_confirmation`

| Chord source (priority order)                                                                                                                   | ShopMy field            | Notes                                                 |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ----------------------------------------------------- |
| `properties.subtotal` > `properties.revenue` > `properties.total` > `properties.value` > `properties.price` > sum of product `price × quantity` | `orderAmount`           | Defaults to `0`                                       |
| `properties.cart_id` > `properties.cartId` > `properties.order_id` > `properties.orderId` > `properties.id`                                     | `orderId`               | A cart ID wins over an order ID when both are present |
| `sms_click_id` cookie                                                                                                                           | `clickId`               | Optional; only included in the payload when present   |
| `properties.currency` > `properties.meta.i18n.currency`                                                                                         | `currency`              | Defaults to `"USD"`                                   |
| `properties.is_returning_customer`                                                                                                              | `is_returning_customer` | Defaults to `false`                                   |
| `window.location.href`                                                                                                                          | `page_url`              | Current page URL at the time of the event             |
| `properties.coupon` > `properties.discount_code`                                                                                                | `code`                  | Coupon or discount code; `null` if not present        |

The API request has a 5-second timeout. If the request times out or fails, a warning is logged and the event is dropped.

## Custom events

Chord does not send other track events to ShopMy, because ShopMy only tracks `Order Completed`. Other track events are skipped with a console warning.

## Initialization

Chord loads `https://static.shopmy.us/Affiliates/sms_aff_clicktrack.js` on the first event of any type. This script handles affiliate click attribution by reading URL parameters and setting the `sms_click_id` cookie.

Chord tracks loading state (`fresh` → `loading` → `loaded`/`failed`) to prevent duplicate script loads. Events that arrive while the script is loading are queued and processed after initialization completes. If the script fails to load, later events are silently dropped.

## CSP requirements

If your site uses a Content Security Policy, allow the following domains:

| Directive     | Domain                     |
| ------------- | -------------------------- |
| `script-src`  | `https://static.shopmy.us` |
| `connect-src` | `https://api.shopmy.us`    |


---

# 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://docs.chord.co/activate/event-streaming/destinations/attribution-and-affiliate/shopmy.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.
