Link Standard Events to Conversion Events
Not integrating the Reddit Pixel as a custom pixel in Shopify? We suggest looking at our event setup tool instead.
You can use the Reddit Pixel to share conversion events based on website actions. The Pixel identifies the conversion event based on the customer event and Reddit conversion event in the analytics.subscribe()
function.
This integration requires a little technical skill. If that's not in your wheelhouse, you might want to ask the right technical support person on your team for assistance.
To ensure proper deduplication, don't set up multiples of the same conversion event for the Reddit Pixel. This means you should include all the metadata you need in one event. Misconfigurations can lead to more chances of duplications. Ensure you've correctly set up all the needed signals for accurate deduplication.
Before you start
Install the Pixel as a custom pixel in Shopify. If you've implemented it in your site template, we strongly recommend adding events with the event setup tool instead.
Create a conversion event
You can send a conversion event by linking a customer event to a Reddit conversion event. To set up a conversion event, add analytics.subscribe()
to your custom pixel in Shopify.
analytics.subscribe("{{Standard event}}", (event) => {
rdt("track", "{{Event Name}}");
});
You can create a custom conversion event by setting {{Event Name}}
to Custom
and assigning customEventName
to a value that does not match our pre-existing events. This value may use any UTF-8 character and can have up to 64 characters including spaces. It's also free-form and case-sensitive. For example, Promotion Event
and PromotionEvent
will be considered two distinct events.
You can create as many custom conversion events as you'd like, but only the twenty most recent events will be visible in the Events Manager.
analytics.subscribe("Promotion Event", (event) => {
rdt("track", "Custom", { customEventName: "Promotion Event" });
});
You can also customize your event to return event metadata fields:
analytics.subscribe("checkout_completed", (event) => {
const checkout = event.data.checkout;
rdt("track", "Purchase", {
//customer match keys
email: checkout.email,
phoneNumber: checkout.phone,
//event metadata
currency: checkout.currencyCode,
value: checkout.totalPrice.amount,
itemCount: checkout.lineItems.reduce((total, item) => total + item.quantity, 0),
conversionId: checkout.order.id,
products: checkout.lineItems.map(item => ({
id: item.variant.sku,
category: item.variant.product.type,
name: item.title
}))
});
});
Reference
Some events support parameters, which lets you customize the event to fit your needs. See how it works.
Add to Wishlist, Lead, and Sign Up events aren't natively supported by Shopify. You'll need to create custom events to add these as events on your site.
Some events have required metadata to ensure that your conversion events are DPA ready.
Page Visit
analytics.subscribe("page_viewed", (event) => {
rdt('track', 'PageVisit', {
conversionId: event.id
});
});
View Content
analytics.subscribe("product_viewed", (event) => {
rdt('track', 'ViewContent', {
conversionId: event.id,
products: {
id: event.data.productVariant.sku,
category: event.data.productVariant.product.type,
name: event.data.productVariant.product.title
}
});
});
Search
analytics.subscribe("search_submitted", (event) => {
rdt("track", "Search", {
conversionId: event.id
});
});
Add to Cart
analytics.subscribe("product_added_to_cart", (event) => {
const cartLine = event.data.cartLine;
rdt('track', 'AddToCart', {
conversionId: event.id,
currency: cartLine.merchandise.price.currencyCode,
value: cartLine.cost.totalAmount.amount,
itemCount: cartLine.quantity,
products: {
id: cartLine.merchandise.sku,
category: cartLine.merchandise.product.type,
name: cartLine.merchandise.product.title
}
});
});
Purchase
analytics.subscribe("checkout_completed", (event) => {
const checkout = event.data.checkout;
rdt('track', 'Purchase', {
//customer match keys
email: checkout.email,
phoneNumber: checkout.phone,
//event metadata
currency: checkout.currencyCode,
value: checkout.totalPrice.amount,
itemCount: checkout.lineItems.reduce((total, item) => total + item.quantity, 0),
conversionId: checkout.order.id,
products: checkout.lineItems.map(item => ({
id: item.variant.sku,
category: item.variant.product.type,
name: item.title
}))
});
});
Custom
{{Event name}}
should be set to the name of your custom event.
analytics.subscribe("{{Event name}}", (event) => {
rdt("track", "Custom", {
customEventName: "{{Event name}}",
conversionId: event.id
});
});
Add event metadata
Event metadata is information associated with specific actions or events shared by first-party tools in advertising campaigns. Setting up metadata shares more performance insights, and using a consistent Conversion ID is crucial when using both the Pixel and CAPI for deduplication purposes.
To set up event metadata manually, you'll need to add the metadata parameters you want to a conversion event. This may require some coding to retrieve the right values.
analytics.subscribe("Promotion Event", (event) => {
const { checkout } = event.data;
rdt("track", "Purchase", {
products: checkout.lineItems.map(item => ({
id: item.variant.sku,
category: item.variant.product.type,
name: item.title
})),
conversionId: event.data.checkout.event.id,
currency: cartLine.merchandise.price.currencyCode,
value: cartLine.cost.totalAmount.amount,
itemCount: cartLine.quantity
});
});
Reference
Item count
- AddToCart
- Purchase
itemCount: cartLine.quantity
itemCount: checkout.lineItems.reduce((total, item) => total + item.quantity, 0)
Value decimal
- AddToCart
- Purchase
value: cartLine.cost.totalAmount.amount
value: checkout.totalPrice.amount
Currency
- AddToCart
- Purchase
currency: cartLine.merchandise.price.currencyCode
currency: checkout.currencyCode
Conversion ID
This is only required when implementing both the Pixel and CAPI.
conversionId: event.id
Products
- ViewContent
- AddToCart
- Purchase
products: [{
id: event.data.productVariant.sku,
category: event.data.productVariant.product.type,
name: event.data.productVariant.product.title
}]
products: [{
id: cartLine.merchandise.sku,
category: cartLine.merchandise.product.type,
name: cartLine.merchandise.product.title
}]
products: checkout.lineItems.map((item) => ({
id: item.variant.sku,
category: item.variant.product.type,
name: item.title
}))
Add customer match keys
Customer match keys are user identifiers that help improve conversion measurement. You can set up Purchase
to dynamically pass email address and phone number. We recommend sharing as many keys as possible.
Reference
Parameter | Example code |
---|---|
Email address | email: checkout.email |
Phone number | phoneNumber: checkout.phone |