Skip to content

[Feature]: Implement link click analytics — track redirect counts per platform link with a daily aggregation table #562

Description

@divyanshim27

Summary

LinkID is a professional identity and link-routing platform. Currently, when a user visits linkid.qzz.io/username/github they are redirected to the target URL, but no data is recorded about this interaction. Users have no visibility into how many times their links are being accessed or which platforms are most popular. This is a significant gap for a tool whose core value proposition is professional discoverability.

Problem

  • The platform redirect handler at app/[username]/[platform]/page.tsx performs the redirect with no side-effect logging
  • There is no clicks or analytics table in the Prisma schema
  • Users cannot see engagement metrics for their public profile or individual platform links
  • This limits the product's utility — a developer sharing linkid.qzz.io/vishnu on a resume cannot know if anyone clicked through

Proposed Solution

Step 1 — Add a Prisma schema migration:

// prisma/schema.prisma
model LinkClick {
  id        String   @id @default(cuid())
  linkId    String
  link      Link     @relation(fields: [linkId], references: [id], onDelete: Cascade)
  clickedAt DateTime @default(now())
  
  @@index([linkId])
  @@index([clickedAt])
}

Step 2 — Record a click on each redirect:

// app/[username]/[platform]/page.tsx
import { prisma } from '@/lib/prisma';

// After resolving the link:
await prisma.linkClick.create({ data: { linkId: link.id } });

Step 3 — Add an analytics API endpoint:

// app/api/analytics/route.ts
// Returns click counts per link for the authenticated user
const analytics = await prisma.linkClick.groupBy({
  by: ['linkId'],
  _count: { id: true },
  where: { link: { userId: session.user.id } },
});

Step 4 — Display click counts on the dashboard next to each link entry.

I will implement all four steps in a single PR, including the Prisma migration file.

Labels: enhancement, feature, database, GSSoC 2026

Could you assign this issue to me?

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions