# Reddit Destination


Reddit's [Conversions API](https://reddit.my.site.com/helpcenter/s/article/Conversions-API) is a server-to-server solution for tracking and sharing your web conversion data with Reddit.

Find the open source transformer code for this destination in the [GitHub repository](https://github.com/rudderlabs/rudder-transformer/tree/main/src/cdk/v2/destinations/reddit).

## Connection compatibility

{{< destination-config >}}

## Setup

1. In your [RudderStack dashboard](https://app.rudderstack.com/), set up a source.
2. Go to the **Overview** tab of your source and select **Add Destination** > **Create new destination**.

{{< image src="images/event-stream-destinations/add-new-destination.webp" alt="Add new destination in RudderStack dashboard" >}}

3. Select **Reddit** from the list of destinations. Then, click **Continue**.

### Connection settings

| Setting | <div style="width:350px">Description</div> |
| :----| :----|
| Name | Assign a name to uniquely identify the destination. |
| Event delivery account | Click **Create Account** > **Connect with Reddit**. Then, give RudderStack the necessary permissions to access your Reddit account. |
| API Version | Select the Reddit API version from the dropdown. <br /><br />{{< warning >}}API v2 is deprecated but not yet sunset. <br /><br />For existing connections that leverage API v2, see [Reddit Destination v3 Migration Guide]({{< ref "destinations/streaming-destinations/reddit/v3-migration.md" >}}) for more information on how to migrate to API v3.{{< /warning >}} |
| Pixel ID | Enter the [Pixel ID](#faq) of your Reddit Ads account associated with the conversion events. |
| Hash Data | This setting is turned on by default. RudderStack hash encrypts the event properties (for example, `email`, `userId`, `ip`, etc.) before sending them to Reddit. <br /><br />{{< warning >}}If you are already hashing this data before sending it to RudderStack, make sure to turn off this setting.{{< /warning >}} |

### Configuration settings

| Setting | <div style="width:350px">Description</div> |
| :----| :----|
| Consent management settings | Configure the consent management settings for the specified source by choosing the **Consent management provider** from the dropdown and entering the relevant consent category IDs. <br /><br />See [Consent Management in RudderStack]({{< ref "data-governance/consent-management/overview.md" >}}) for more information on this feature. |

### Event mapping settings

Click **Set up mapping** to map your RudderStack events to specific Reddit events. You can also use the JSON mapper to set these mappings.

{{< image src="images/event-stream-destinations/reddit-event-mapping.webp" alt="Reddit event mapping setting" >}}

## Track

You can use the [`track`]({{< ref "event-spec/standard-events/track.md" >}}) call to record and send conversion events  along with any associated properties to Reddit for processing.

A sample `track` event sent to Reddit:

```javascript
rudderanalytics.track("Order Completed", {
  revenue: 500,
  currency: "INR",
  conversionId: "G53B1A44XQ",
  clickId: "4583752045291814500",
  products: [{
    product_id: "item1",
    sku: "9472-775-0112",
    name: "Sample Item",
    price: 30,
    position: 1,
    category: "Sample Items"
    url: "https://www.website.com/sample-product/",
    image_url: "https://www.website.com/product/path.jpg",
  }]
}, {
  traits: {
    email: "alex@example.com",
    userId: "1hKOmRA4GRlm",
    firstName: "Alex",
    lastName: "Keener"
  }
});
```

### Standard event mappings

You can use the [Event mapping settings](#event-mapping-settings) in the dashboard to map your events to the below Reddit standard events:

- `AddToCart`
- `AddToWishlist`
- `Lead`
- `PageVisit`
- `Purchase`
- `Search`
- `SignUp`
- `ViewContent`

Note that RudderStack automatically maps the following standard [ecommerce events]({{< ref "event-spec/ecommerce-events-spec/_index.md" >}}) to Reddit's standard `tracking_type` events:

| RudderStack event | Reddit standard event |
| :----| :----| 
| `Order Completed` | `Purchase` |
| `Product Viewed` <br /> `Product List Viewed` | `ViewContent` |
| `Product Added` | `AddToCart` |
| `Product Added to Wishlist` | `AddToWishlist` |
| `Products Searched` | `Search` |

{{< warning >}}
If you do not map your events in the RudderStack dashboard and they do not match the above standard ecommerce events, then RudderStack automatically sends them as custom events and maps them to Reddit's `Custom` tracking type.
{{< /warning >}}

### Supported mappings

RudderStack maps the following event properties in the `track` events to the corresponding Reddit fields:

| RudderStack property | Reddit property (API v2) | Reddit property (API v3) |
| -- | -- | -- |
| `event` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `tracking_type` as set in the dashboard or as per the above [standard mapping](#standard-event-mappings). | Same as API v2 |
| `event` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `custom_event_name` with `tracking_type` set to `Custom` | Same as API v2 |
| `originalTimestamp` <br/> <span style="color: #4D4DFF;font-size:12px;">Required</span> | `event_at` | Same as API v2 |
| `context.ip` <br /> `request_ip` | `user.ip_address` | Same as API v2 |
| `context.userAgent` | `user.user_agent` | Same as API v2 |
| `context.traits.userId` | `user.external_id` | Same as API v2 |
| `properties.uuid` | `user.uuid` | Same as API v2 |
| `context.screen.height` | `user.screen_dimensions.height` | Same as API v2 |
| `context.screen.width` | `user.screen_dimensions.width` | Same as API v2 |
| `context.device.advertisingId` | `user.idfa` / `user.aaid` | Same as API v2 |
| `traits.email` <br /> `context.traits.email` | `user.email` | Same as API v2 |
| `traits.phone` <br /> `context.traits.phone` <br /> `properties.phone` | Not available | `user.phone_number` |
| `traits.region` <br /> `context.traits.region` | Not available | `user.data_processing_options.region` |
| `traits.country` <br /> `context.traits.country` | Not available | `user.data_processing_options.country` |
| `properties.clickId` | `click_id` | Same as API v2 |
| `integrations.REDDIT.action_source` <br /> `channel` <br /> `context.os.name` | Not available | `action_source` |
| `context.page.url` <br /> `properties.url` | Not available | `event_source_url` |
| `properties.conversionId` <br /> `messageId` | `event_metadata.conversion_id` | `metadata.conversion_id` |
| `properties.currency` | `event_metadata.currency` | `metadata.currency` |
| `properties.modes` | Not available | `user.data_processing_options.modes` |
| `properties.optOut` | `opt_out` | Deprecated |
| `properties.products.$.quantity` <br /> `properties.quantity` <br /> `properties.item_count` | `event_metadata.item_count` | `metadata.item_count` |
| `properties.products.$.category` | `event_metadata.products.$.category` | `metadata.products.$.category` |
| `properties.products.$.product_id` | `event_metadata.products.$.id` | `metadata.products.$.id` |
| `properties.products.$.name` | `event_metadata.products.$.name` | `metadata.products.$.name` |
| `properties.products.$.price` <br /> `properties.price` | Not available | `metadata.products.$.item_price` |
| `properties.products.$.quantity` <br /> `properties.quantity` | Not available | `metadata.products.$.quantity` |
| `properties.revenue` | `event_metadata.value` | `metadata.value` |
| `properties.test_Id` | Not available | `test_id` |

#### Override action source 

RudderStack sets `action_source` on API v3 events using the following precedence:

| Precedence order | Description | Accepted values |
| :----| :-----| :----|
| 1  | Set `integrations.REDDIT.action_source` in the event with any of the accepted values. | <ul><li>`WEBSITE`</li><li>`APP`</li><li>`PHYSICAL_STORE`</li><li>`OTHER`</li></ul> |
| 2 | Auto-detection — if no override is set, RudderStack detects the value automatically. <br /><br /><ul><li>`APP` when `channel` is `mobile` and `context.os.name` is `android` or an Apple family OS (iOS, iPadOS, macOS, etc.)</li><li>`WEBSITE` for all other events</li></ul> | - |

To override `action_source`, include it in the `integrations.REDDIT` object, as shown:

```javascript
rudderanalytics.track("Order Completed", {
  revenue: 500,
  currency: "USD"
}, {
  integrations: {
    REDDIT: {
      action_source: "PHYSICAL_STORE"
    }
  }
});
```

#### Event source URL

RudderStack maps `context.page.url` to `event_source_url`, with `properties.url` as a fallback. 

It sends `event_source_url` only when `action_source` is `WEBSITE`, per Reddit's API requirements.

#### Product price and quantity

For API v3 events with product metadata, RudderStack maps per-product `item_price` and `quantity` from standard ecommerce properties. Both fields are optional — events without price or quantity data continue to transform as before. 

When present, `item_price` must be a non-negative number and `quantity` must be a non-negative integer.

## FAQ 

#### Where can I find the Pixel ID?

1. Log in to the [Reddit Ads Manager account](https://accounts.reddit.com/adsregister). 
2. Select **Events Manager** from the drop-down menu in the top-left corner.

{{< image src="images/event-stream-destinations/reddit-pixel-id-1.webp"  >}}

3. Select **Set Up Reddit Pixel** and choose from one of the below options according to your requirement:

{{< image src="images/event-stream-destinations/reddit-pixel-id.webp"  >}}

Based on the selected option, you will find your Pixel ID on the next screen.

See [Reddit Pixel documentation](https://business.reddithelp.com/helpcenter/s/article/Install-the-Reddit-Pixel-on-your-website) for more information on setting up the Reddit Pixel.
