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 title in the response

Kiran K1b6b1f2c27b9
diff --git a/apps/web/lib/analytics/get-analytics.ts b/apps/web/lib/analytics/get-analytics.ts
index 617c4fd014..f079766d06 100644
--- a/apps/web/lib/analytics/get-analytics.ts
+++ b/apps/web/lib/analytics/get-analytics.ts
@@ -145,6 +145,7 @@ export const getAnalytics = async (params: AnalyticsFilters) => {
key: true,
url: true,
comments: true,
+ title: true,
createdAt: true,
},
});
@@ -171,6 +172,7 @@ export const getAnalytics = async (params: AnalyticsFilters) => {
key: punyEncode(link.key),
}),
comments: link.comments,
+ title: link.title || null,
createdAt: link.createdAt.toISOString(),
...topLink,
});
diff --git a/apps/web/lib/zod/schemas/analytics-response.ts b/apps/web/lib/zod/schemas/analytics-response.ts
index 3a1e9ddfd8..90cdc3410d 100644
--- a/apps/web/lib/zod/schemas/analytics-response.ts
+++ b/apps/web/lib/zod/schemas/analytics-response.ts
@@ -299,6 +299,10 @@ export const analyticsResponse = {
shortLink: z.string().describe("The short link URL"),
url: z.string().describe("The destination URL of the short link"),
comments: z.string().nullish().describe("The comments of the short link"),
+ title: z
+ .string()
+ .nullish()
+ .describe("The custom link preview title (og:title)"),
createdAt: z
.string()
.describe("The creation timestamp of the short link"),