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 trigger endpoint

Steven Teyc83edebb29e0
diff --git a/apps/web/lib/analytics/constants.ts b/apps/web/lib/analytics/constants.ts
index a9d5c49c38..861ac4c7c3 100644
--- a/apps/web/lib/analytics/constants.ts
+++ b/apps/web/lib/analytics/constants.ts
@@ -93,6 +93,7 @@ export const VALID_ANALYTICS_ENDPOINTS = [
"referers",
"top_links",
"top_urls",
+ "trigger",
] as const;
export const SINGULAR_ANALYTICS_ENDPOINTS = {
diff --git a/apps/web/lib/analytics/types.ts b/apps/web/lib/analytics/types.ts
index 5e2dddd52c..86c5ffb896 100644
--- a/apps/web/lib/analytics/types.ts
+++ b/apps/web/lib/analytics/types.ts
@@ -12,7 +12,8 @@ export type AnalyticsEndpoints =
| "os"
| "referers"
| "top_links"
- | "top_urls";
+ | "top_urls"
+ | "trigger";
export type LocationTabs = "countries" | "cities";
export type LocationTabsSingular = "country" | "city";
export type TopLinksTabs = "link" | "url";
diff --git a/apps/web/lib/zod/schemas/clicks-analytics.ts b/apps/web/lib/zod/schemas/clicks-analytics.ts
index 7ae5b43261..8872b099c9 100644
--- a/apps/web/lib/zod/schemas/clicks-analytics.ts
+++ b/apps/web/lib/zod/schemas/clicks-analytics.ts
@@ -53,4 +53,12 @@ export const clickAnalyticsResponse = {
url: z.string().describe("The destination URL"),
clicks: z.number().describe("The number of clicks from this URL"),
}),
+ trigger: z.object({
+ trigger: z
+ .enum(["link", "qr"])
+ .describe("The type of trigger method: link click or QR scan"),
+ clicks: z
+ .number()
+ .describe("The number of clicks from this trigger method."),
+ }),
} as const;