Skip to content

small updates to the default mappings in the Reddit CAPI integration #2893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ describe('Reddit Conversions Api', () => {
userId: 'user_id_1',
properties: {
click_id: 'click_id_1',
conversion_id: 'ea3d01f99e303d2338cfb4e71f182441eb57c9a3cb129c40bcae9f5d641a7375',
currency: 'USD',
quantity: 10,
total: 100,
revenue: 100,
uuid: 'uuid_1',
products: [
{ product_id: 'product_id_1', category: 'category_1', name: 'name_1' },
Expand Down Expand Up @@ -60,7 +59,7 @@ describe('Reddit Conversions Api', () => {
click_id: 'click_id_1',
event_at: '2024-01-08T13:52:50.212Z',
event_metadata: {
conversion_id: '492ebaa71872336ef94c7093b77d2232fdba7e469f716586a816d861367b183f',
conversion_id: '5184171f53a0fd17f59ea50fac8e11d9eb589ed0692920ee4f52a357112e6802',
currency: 'USD',
item_count: 10,
products: [
Expand Down Expand Up @@ -99,12 +98,11 @@ describe('Reddit Conversions Api', () => {
const event = createTestEvent({
timestamp: timestamp,
event: 'Some Custom Event Name',
messageId: 'test-message-id-contact',
messageId: '492ebaa71872336ef94c7093b77d2232fdba7e469f716586a816d861367b183f',
type: 'track',
userId: 'user_id_1',
properties: {
click_id: 'click_id_1',
conversion_id: '492ebaa71872336ef94c7093b77d2232fdba7e469f716586a816d861367b183f',
currency: 'USD',
quantity: 10,
total: 100,
Expand Down Expand Up @@ -189,10 +187,10 @@ describe('Reddit Conversions Api', () => {
userId: 'user_id_1',
properties: {
click_id: 'click_id_1',
conversion_id: 'ea3d01f99e303d2338cfb4e71f182441eb57c9a3cb129c40bcae9f5d641a7375',
currency: 'USD',
quantity: 10,
total: 100,
revenue: 100,
total: 30,
uuid: 'uuid_1',
products: [
{ product_id: 'product_id_1', category: 'category_1', name: 'name_1' },
Expand Down Expand Up @@ -227,7 +225,7 @@ describe('Reddit Conversions Api', () => {
click_id: 'click_id_1',
event_at: '2024-01-08T13:52:50.212Z',
event_metadata: {
conversion_id: '492ebaa71872336ef94c7093b77d2232fdba7e469f716586a816d861367b183f',
conversion_id: '5184171f53a0fd17f59ea50fac8e11d9eb589ed0692920ee4f52a357112e6802',
currency: 'USD',
item_count: 10,
products: [
Expand Down Expand Up @@ -270,9 +268,8 @@ describe('Reddit Conversions Api', () => {
userId: 'user_id_1',
properties: {
click_id: 'click_id_1',
conversion_id: 'ea3d01f99e303d2338cfb4e71f182441eb57c9a3cb129c40bcae9f5d641a7375',
currency: 'USD',
total: 100,
revenue: 100,
uuid: 'uuid_1',
products: [
{ product_id: 'product_id_1', category: 'category_1', name: 'name_1' },
Expand Down Expand Up @@ -307,7 +304,7 @@ describe('Reddit Conversions Api', () => {
click_id: 'click_id_1',
event_at: '2024-01-08T13:52:50.212Z',
event_metadata: {
conversion_id: '492ebaa71872336ef94c7093b77d2232fdba7e469f716586a816d861367b183f',
conversion_id: '5184171f53a0fd17f59ea50fac8e11d9eb589ed0692920ee4f52a357112e6802',
currency: 'USD',
products: [
{
Expand Down Expand Up @@ -344,12 +341,11 @@ describe('Reddit Conversions Api', () => {
const event = createTestEvent({
timestamp: timestamp,
event: 'Lead Generated',
messageId: 'test-message-id-contact',
messageId: 'ea3d01f99e303d2338cfb4e71f182441eb57c9a3cb129c40bcae9f5d641a7375',
type: 'track',
userId: 'user_id_1',
properties: {
click_id: 'click_id_1',
conversion_id: 'ea3d01f99e303d2338cfb4e71f182441eb57c9a3cb129c40bcae9f5d641a7375',
currency: 'USD',
total: 100,
uuid: 'uuid_1',
Expand Down Expand Up @@ -466,6 +462,7 @@ describe('Reddit Conversions Api', () => {
event_at: '2024-01-08T13:52:50.212Z',
event_metadata: {
currency: 'USD',
conversion_id: '5184171f53a0fd17f59ea50fac8e11d9eb589ed0692920ee4f52a357112e6802',
products: [
{
category: 'category_1',
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ export const click_id: InputField = {

export const conversion_id: InputField = {
label: 'Conversion ID',
description: 'The unique conversion ID that corresponds to a distinct conversion event.',
description:
'The unique conversion ID that corresponds to a distinct conversion event. Use this for event deduplication.',
type: 'string',
required: false,
default: { '@path': '$.properties.conversion_id' },
default: { '@path': '$.messageId' },
category: 'hashedPII'
}

Expand Down Expand Up @@ -99,7 +100,11 @@ export const event_metadata: InputField = {
'@path': '$.properties.quantity'
},
value_decimal: {
'@path': '$.properties.total'
'@if': {
exists: { '@path': '$.properties.revenue' },
then: { '@path': '$.properties.revenue' },
else: { '@path': '$.properties.total' }
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ const destination: DestinationDefinition<Settings> = {
partnerAction: 'standardEvent',
mapping: {
...defaultValues(standardEvent.fields),
tracking_type: 'AddToCart'
tracking_type: 'AddToCart',
event_metadata: {
currency: { '@path': '$.properties.currency' },
itemCount: { '@path': '$.properties.quantity' },
value: { '@path': '$.properties.price' }
}
},
type: 'automatic'
},
Expand All @@ -139,7 +144,12 @@ const destination: DestinationDefinition<Settings> = {
partnerAction: 'standardEvent',
mapping: {
...defaultValues(standardEvent.fields),
tracking_type: 'AddToWishlist'
tracking_type: 'AddToWishlist',
event_metadata: {
currency: { '@path': '$.properties.currency' },
itemCount: { '@path': '$.properties.quantity' },
value: { '@path': '$.properties.price' }
}
},
type: 'automatic'
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading