---
title: Server Event Tracking
slug: server-event-tracking
docTags: 
createdAt: 2024-03-14T19:06:18.289Z
---

When installed on your storefront, Chord typically sends tracking events to the CDP from two sources:

- Your website front-end, either using the Chord Shopify web pixel or `@chordcommerce/analytics`, and
- Chord's server events service, which sends tracking events from a Shopify custom source function in your CDP workspace in response to webhook triggers from Shopify.&#x20;

When Chord provisions your CDP workspace, it will include Chord's Shopify webhook source. This code listens for webhook events from Shopify and transforms them into CDP events.

## Requirements

Locate Chord's webhook source in your CDP workspace, named "Shopify Webhooks." Chord typically creates this webhook source as part of your CDP workspace provisioning. You'll need to update the settings of this source during the **Create an Admin API Key** step, and you'll need the webhook URL of this source during the **Create Webhook Subscriptions** step. If you can't find the source or aren't sure which one it is, please contact Chord.

## Installation

There are two steps to configuring server events: creating an Admin API key and adding it to the CDP source; and subscribing the CDP source to Shopify webhook events.

### Creating an Admin API key

Chord's CDP source requires an admin API key with the `read_orders` scope to retrieve order details from Shopify. To generate this admin API key, we recommend creating a custom Shopify app in your Shopify account for Chord, and using the Admin API access token from this custom app. This makes it easy to manage access.

Create a new custom app in your Shopify admin by navigating to **Settings** > **Apps and sales channels** > **Develop apps** > **Create an app**. Once the app is created, click **Configure Admin API Scopes**. Choose `read_orders` only and hit **Save.**

On the **Overview** tab, you should see a prompt to **Install to get your access token**. Click **Install app**. Now you should see this:

![](https://api.archbee.com/api/optimize/TmutqdeXiIw-V3gBZXVjd/-HtEyo6KDxhwiwkkLSvnM_untitled-5.png)

Copy the Admin API access token. In your CDP workspace, navigate to your Chord webhook source and view the settings under **Settings** > **Connection**. Enter the Admin API access token you just created in the **Access Token** or **accessToken** settings field, and **Save Changes**.

### Creating Webhook Subscriptions

In your CDP workspace, navigate to your Chord webhook source and find the webhook URL for the source under the **Configure your webhook** heading.

Now you'll create webhook subscriptions in Shopify. You can create webhook subscriptions either via the [Shopify admin](https://help.shopify.com/en/manual/orders/notifications/webhooks) or the [Admin API](https://shopify.dev/docs/api/admin-rest/2024-01/resources/webhook#post-webhooks). You can use the Admin API access token you created for Chord to create the subscription via the Admin API.

Create a subscription for each server event you'd like Chord to send to the CDP. Each subscription will have the same address, which is the URL you copied from your CDP source. Please see the [Webhook Event Payloads](docId\:yPb3xYAkaZuf0hBmfTW7S) page for the list of supported topics.

Shopify's webhook testing doesn't include a payload that matches a real webhook payload, so we recommend completing a test transaction in your Shopify store to verify that server events are flowing as expected. You can view the CDP events in the **Debugger** tab of the Shopify webhook source in your CDP workspace.

## Storefront configuration

To associate server events and front-end storefront events with the same session, the website front-end needs to save a few browser identifiers as attributes on the cart or order, so they can be retrieved later by the server source and included in CDP events. See [Unifying Data Across Sources](docId\:FYmI5G8eWB-YYpyh-GU4o) for more details.
