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.

Update extract-utm-params.ts

Steven Teyb341e5e711d8
diff --git a/apps/web/lib/api/utm/extract-utm-params.ts b/apps/web/lib/api/utm/extract-utm-params.ts
index ca1c258eda..29e1ccf4e7 100644
--- a/apps/web/lib/api/utm/extract-utm-params.ts
+++ b/apps/web/lib/api/utm/extract-utm-params.ts
@@ -4,7 +4,16 @@ export const extractUtmParams = (
utmTemplate: UtmTemplate | null,
{ excludeRef = false }: { excludeRef?: boolean } = {},
) => {
- if (!utmTemplate) return {};
+ // if there is no utm template, return null for all utm params
+ if (!utmTemplate)
+ return {
+ utm_source: null,
+ utm_medium: null,
+ utm_campaign: null,
+ utm_term: null,
+ utm_content: null,
+ ...(excludeRef ? {} : { ref: null }),
+ };
return {
utm_source: utmTemplate.utm_source,
utm_medium: utmTemplate.utm_medium,