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.

Fix Analytics SDK regions bug

Steven Tey7bdb608c633c
diff --git a/apps/web/lib/zod/schemas/analytics-response.ts b/apps/web/lib/zod/schemas/analytics-response.ts
index bbb03ed838..3a1e9ddfd8 100644
--- a/apps/web/lib/zod/schemas/analytics-response.ts
+++ b/apps/web/lib/zod/schemas/analytics-response.ts
@@ -93,6 +93,7 @@ export const analyticsResponse = {
.describe(
"The 2-letter ISO 3166-1 country code for the country associated with the location of the user. Learn more: https://d.to/geo",
),
+ region: z.literal("*").default("*"),
city: z.literal("*").default("*"),
clicks: z
.number()
@@ -115,14 +116,15 @@ export const analyticsResponse = {
regions: z
.object({
+ country: z
+ .enum(COUNTRY_CODES)
+ .describe("The 2-letter country code of the region: https://d.to/geo"),
region: z
.string()
.describe(
"The 2-letter ISO 3166-2 region code representing the region associated with the location of the user.",
),
- country: z
- .enum(COUNTRY_CODES)
- .describe("The 2-letter country code of the region: https://d.to/geo"),
+ city: z.literal("*").default("*"),
clicks: z
.number()
.describe("The number of clicks from this region")
@@ -144,10 +146,11 @@ export const analyticsResponse = {
cities: z
.object({
- city: z.string().describe("The name of the city"),
country: z
.enum(COUNTRY_CODES)
.describe("The 2-letter country code of the city: https://d.to/geo"),
+ region: z.literal("*").default("*"),
+ city: z.string().describe("The name of the city"),
clicks: z
.number()
.describe("The number of clicks from this city")