> For the complete documentation index, see [llms.txt](https://help.littledata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.littledata.io/integrations/shopify-to-segment/connect-segment-to-facebook-conversions-api.md).

# Connect Segment to Meta Conversions API

## Connect Segment to Meta Conversions API

Littledata's [Shopify source for Segment](https://help.littledata.io/integrations/shopify-to-segment) sends the Meta identifiers that Segment's cloud-mode [Meta Conversions API destination](https://segment.com/docs/connections/destinations/catalog/facebook-pixel-server-side/#server-event-parameter-requirements) needs. This page covers the extra Segment settings to get Meta Ads tracking working end to end.

If you don't need Segment in the middle, Littledata also has a direct [Shopify to Meta Conversions API](https://help.littledata.io/integrations/facebook-capi/how-it-works-shopify-to-meta-conversions-api) connection.

You need both the Meta Pixel in the browser and server-side tracking through the Conversions API.

### Add the Meta Pixel to all landing pages

The Meta Pixel tracks page views and sets the Meta cookies. Segment adds it for you when you set up Segment's [Meta Pixel destination](https://segment.com/docs/connections/destinations/catalog/facebook-pixel). You can also add the Meta Pixel code to your Shopify theme yourself.

### Turn on user matching

To get a high match rate between browser and server events, both must send the same external ID. This is the Segment `userId`, or the `anonymousId` when there's no user ID.

{% stepper %}
{% step %}

#### Open the Meta Pixel destination

In Segment, open the settings for your Meta Pixel destination.
{% endstep %}

{% step %}

#### Turn on advanced matching

Turn on **Enable Advanced Matching**.
{% endstep %}

{% step %}

#### Use the user ID as external ID

Turn on **Use User ID or Anonymous ID as External ID**, then save.
{% endstep %}
{% endstepper %}

### Map product categories to Meta content types

Segment sets the content type of events from `product_group`. Shopify's Meta sales channel sets every product's content type to `product`. If these don't match, Meta can't link events to your product catalog. To fix this, map your product categories to `product`.

{% stepper %}
{% step %}

#### Open the Conversions API destination

In Segment, open the settings for your Meta Conversions API destination.
{% endstep %}

{% step %}

#### Open the category mapping

Click **Map Categories to FB Content Types**.
{% endstep %}

{% step %}

#### Map every product type

Add each product type in your store and map it to `product`. Also add a mapping for **all**, which covers products with no category. Save your changes.
{% endstep %}
{% endstepper %}

### Set the value field

Littledata's events include several value properties, so you need to tell Segment which one to send as Meta's `value`.

| Segment event                                                              | Property with the value                         |
| -------------------------------------------------------------------------- | ----------------------------------------------- |
| Product and checkout events (for example, Product Added, Checkout Started) | `price`                                         |
| Order Completed                                                            | `total`, and `revenue` if turned on (see below) |

{% hint style="info" %}
Order Completed events have no `price` property. If Segment maps `price` to Meta's `value`, your Purchase events will have no value.
{% endhint %}

{% stepper %}
{% step %}

#### Add revenue to purchase events

In the Littledata app, open your Segment connection settings. On the **Tracking customisation** tab, turn on **Include revenue on purchase events**, then click **Save**. Order Completed events now include a `revenue` property.
{% endstep %}

{% step %}

#### Open the value setting in Segment

In Segment, open your Meta Conversions API destination settings and click **Value Field Identifier**.
{% endstep %}

{% step %}

#### Choose the value property

Choose the property that holds the value for each event, then click **Save**. Make sure Purchase events take their value from `revenue` (or `total`), not `price`.
{% endstep %}
{% endstepper %}

### Supported events

Littledata's Segment source supports these Meta Pixel and Conversions API events:

* View content
* Add to cart
* Initiate checkout
* Add payment info
* Purchase

Other Littledata events may show as not supported or not delivered in Segment.

### Related articles

* [How it Works: Shopify source for Segment](https://help.littledata.io/integrations/shopify-to-segment/how-it-works)
* [Shopify to Segment installation guide](https://help.littledata.io/integrations/shopify-to-segment/installation)
* [How it works: Shopify to Meta Conversions API (CAPI)](https://help.littledata.io/integrations/facebook-capi/how-it-works-shopify-to-meta-conversions-api)
