Skip to content

fix(affiliates): resolve visitorId always-undefined bug with cookie-based deduplication#103

Open
Danieliushka wants to merge 2 commits intoprofullstack:masterfrom
Danieliushka:fix/affiliate-click-dedup
Open

fix(affiliates): resolve visitorId always-undefined bug with cookie-based deduplication#103
Danieliushka wants to merge 2 commits intoprofullstack:masterfrom
Danieliushka:fix/affiliate-click-dedup

Conversation

@Danieliushka
Copy link
Copy Markdown

Summary

Changes

  • src/app/api/affiliates/click/route.ts: Read/generate visitor ID from cookie, pass to recordClick()
  • src/lib/affiliates/tracking.ts: Added 24h dedup query before inserting click

Test plan

  • Click affiliate link → verify ugig_visitor cookie is set
  • Click same link again within 24h → verify no duplicate click recorded
  • Clear cookies → click again → verify counted as new visitor
  • Verify redirect still works correctly

🤖 Generated with Claude Code

Gendolf and others added 2 commits April 13, 2026 18:02
Users were sharing dashboard URLs (which 404) instead of public links.
Adds a small CopyLinkButton component (link icon → green check on copy)
to GigCard, AgentCard, MCP listing cards, and Prompt listing cards so
the correct public URL is one click away.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ased deduplication

- Read ugig_visitor cookie from incoming request; generate a UUID if absent
- Pass visitorId to recordClick() instead of hardcoded undefined
- Set ugig_visitor cookie (1 year) on the redirect response for new visitors
- Add 24h deduplication in recordClick(): same visitorId + trackingCode within
  24 hours is treated as a single click and not double-counted
- IP-hash rate-limit is now a fallback used only when visitorId is unavailable

Fixes profullstack#96

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: affiliate click deduplication not implemented — visitorId always undefined

1 participant