feat: Choice Ad placement with 50/50 A/B test#496
Open
leo-gravity wants to merge 1 commit intoCodebuffAI:mainfrom
Open
feat: Choice Ad placement with 50/50 A/B test#496leo-gravity wants to merge 1 commit intoCodebuffAI:mainfrom
leo-gravity wants to merge 1 commit intoCodebuffAI:mainfrom
Conversation
Introduces a new "Choice Ad" placement that shows 4 ads as side-by-side cards instead of a single banner. Users are deterministically assigned to either the existing banner or the new choice variant via a hash of their userId (50/50 split). Backend: requests 4 placement IDs (choice-ad-1 through choice-ad-4) from Gravity API for the choice variant. All returned ads are stored to ad_impression and impressions fire for each card. Client: new ChoiceAdBanner component renders equal-width bordered cards with CTA button + domain per card, hover effects, and theme-aware styling. Gracefully handles partial fills (1-4 ads). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Files changed
web/src/app/api/v1/ads/_post.tscli/src/hooks/use-gravity-ad.tsAdDataunion type, choice ad cache, fires impressions for all choice adscli/src/components/choice-ad-banner.tsxcli/src/chat.tsxChoiceAdBannerwhen variant ischoiceBefore launching: Gravity dashboard setup required
@jamesgravity — Before enabling this in production, 4 new placements need to be created on the Gravity publisher dashboard for Codebuff:
below_responsechoice-ad-1below_responsechoice-ad-2below_responsechoice-ad-3below_responsechoice-ad-4These should use the same placement type (
below_response) as the existingcode-assist-adplacement. The backend requests all 4 in a single API call for users in the choice variant. If fewer than 4 ads are available, the UI adapts automatically.The existing
code-assist-adplacement remains unchanged and continues to serve the banner variant for 50% of users.Test plan
🤖 Generated with Claude Code