Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Add context data to lead and sale tracking events

Kiran K93819619f82d
diff --git a/apps/web/lib/api/conversions/track-lead.ts b/apps/web/lib/api/conversions/track-lead.ts
index ca296f5278..1ecc90d4d7 100644
--- a/apps/web/lib/api/conversions/track-lead.ts
+++ b/apps/web/lib/api/conversions/track-lead.ts
@@ -232,6 +232,11 @@ export const trackLead = async ({
eventId: leadEventId,
customerId: customer.id,
quantity: eventQuantity ?? 1,
+ context: {
+ customer: {
+ country: customer.country,
+ },
+ },
});
}
diff --git a/apps/web/lib/api/conversions/track-sale.ts b/apps/web/lib/api/conversions/track-sale.ts
index c4a7557cc1..e38248c2f4 100644
--- a/apps/web/lib/api/conversions/track-sale.ts
+++ b/apps/web/lib/api/conversions/track-sale.ts
@@ -208,6 +208,14 @@ export const trackSale = async ({
quantity: 1,
invoiceId,
currency,
+ context: {
+ customer: {
+ country: customer.country,
+ },
+ sale: {
+ productId: metadata?.productId as string,
+ },
+ },
});
if (commission) {