Design Anonymous Product Sharing with Every-Nth Visitor Rewards
MicrosoftSoftware Engineer · OnsiteLast updated
Design product pages and trackable sharing links with anonymous-visitor limits, atomic every-Nth rewards, recoverable redemption, and engagement analytics.
Design a platform where companies create and update product pages containing images and descriptions, generate unique trackable links for social sharing, and inspect each link's reach and engagement. The platform also rewards a designated interval of visitors, such as every 100th or 1000th visitor, to encourage sharing.
The interviewer clarifies that visitors are anonymous. Explain how that affects tracking, reward eligibility, duplicate requests, and claims about unique people.
Constraints & Assumptions
- Product owners can create and update their pages; public visitors follow shareable links.
- Links must be unique and attributable to the correct product and tracking context.
- The source gives every 100th or 1000th user as examples but does not define counter scope, anonymous identity, bot treatment, or reward-claim mechanics. Clarify these before promising a precise rule.
- No traffic scale, fraud tolerance, geographic deployment, or analytics-latency requirement is supplied.
- Do not equate an anonymous browser identifier with a verified person.
Clarifying Questions to Ask
- Is the reward interval counted per link, product, campaign, or across the whole platform?
- Does a counted event mean every click, one browser per period, or another defined anonymous visit?
- Do social preview fetches and automated traffic qualify, and how are they distinguished from eligible visits?
- Must rewards be decided immediately, and what information may be collected later to claim one?
Part 1 — Pages and Trackable Links
Describe content storage, image delivery, link creation, redirects, and owner authorization. Explain which link properties remain stable when a product page is edited.
What This Part Should Cover
- Durable product and link identity with access-controlled editing.
- A unique link mapping and a reliable public resolution path.
- Page/version behavior and attribution that survive content updates.
Part 2 — Count Events and Allocate Rewards
Choose an explicit interpretation of anonymous eligibility for your design and explain its limitations. Show how an interval boundary is assigned once under concurrent requests and retries.
What This Part Should Cover
- Event identity and the limits of cookies or browser IDs.
- Atomic deduplication, counter advancement, and reward creation.
- A separate redemption lifecycle and abuse controls without claiming perfect person-level uniqueness.
Part 3 — Analytics
Explain how click and engagement events become company-facing reports without slowing the redirect path unnecessarily.
What This Part Should Cover
- Durable event capture, aggregation, and deduplicated processing.
- Separation of authoritative reward decisions from approximate analytics where appropriate.
- Transparent definitions of counts, unique-browser estimates, and delayed data.
Hints
Hint 1
A retry is not necessarily another visitor: Two requests can be a network retry, a browser reload, or two different people. Decide what identity the platform can actually observe and what its reward policy counts.
Follow-up questions
- How would one extremely popular link affect an exact global reward counter?
- What happens if a reward is recorded but its response never reaches the visitor?
- Can analytics use eventual consistency if the reward decision must be immediate and exact?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.