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.

Restore Google Ads lead upload for Shopify discount-code attribution and always log webhook responses.

Kiran K36b940f6db54
diff --git a/apps/web/app/(ee)/api/shopify/integration/webhook/route.ts b/apps/web/app/(ee)/api/shopify/integration/webhook/route.ts
index a9ad369d10..362ae75131 100644
--- a/apps/web/app/(ee)/api/shopify/integration/webhook/route.ts
+++ b/apps/web/app/(ee)/api/shopify/integration/webhook/route.ts
@@ -132,17 +132,14 @@ export const POST = async (req: Request) => {
return response;
}
- // orders/paid is logged by processShopifyOrderJob after the order is processed
- if (topic !== "orders/paid") {
- waitUntil(
- captureWebhookLog({
- ...requestLog,
- statusCode: 200,
- duration: Date.now() - startTime,
- responseBody: response,
- }),
- );
- }
+ waitUntil(
+ captureWebhookLog({
+ ...requestLog,
+ statusCode: 200,
+ duration: Date.now() - startTime,
+ responseBody: response,
+ }),
+ );
return new Response(response);
};
diff --git a/apps/web/lib/integrations/shopify/attribute-via-discount-code.ts b/apps/web/lib/integrations/shopify/attribute-via-discount-code.ts
index 920f5ac129..2e17726470 100644
--- a/apps/web/lib/integrations/shopify/attribute-via-discount-code.ts
+++ b/apps/web/lib/integrations/shopify/attribute-via-discount-code.ts
@@ -2,6 +2,7 @@ import { createId } from "@/lib/api/create-id";
import { includeTags } from "@/lib/api/links/include-tags";
import { syncPartnerLinksStats } from "@/lib/api/partners/sync-partner-links-stats";
import { executeWorkflows } from "@/lib/api/workflows/execute-workflows";
+import { queueGoogleAdsConversionUpload } from "@/lib/integrations/google-ads/upload-conversion";
import { generateRandomName } from "@/lib/names";
import { queuePartnerCommissionCreation } from "@/lib/partners/queue-partner-commission-creation";
import { sendPartnerPostback } from "@/lib/postback/send-partner-postback";
@@ -12,7 +13,7 @@ import { WorkspaceProps } from "@/lib/types";
import { sendWorkspaceWebhook } from "@/lib/webhook/publish";
import { transformLeadEventData } from "@/lib/webhook/transform";
import { COUNTRIES_TO_CONTINENTS, nanoid } from "@dub/utils";
-import { Link } from "@prisma/client";
+import { EventType, Link } from "@prisma/client";
import { ShopifyOrder } from "./schema";
export async function attributeViaDiscountCode({
@@ -147,6 +148,19 @@ export async function attributeViaDiscountCode({
}),
}),
+ queueGoogleAdsConversionUpload({
+ workspaceId: workspace.id,
+ eventType: EventType.lead,
+ eventId: leadEvent.event_id,
+ eventName: leadEvent.event_name,
+ conversionDateTime: new Date().toISOString(),
+ conversionCount: 1,
+ click: {
+ id: clickEvent.click_id,
+ url: clickEvent.url,
+ },
+ }),
+
...(link.partnerId
? [
sendPartnerPostback({