All work

Tonic Site Shop

Spice Quiz

A campaign quiz with brand-locked AI imagery and shareable results.

The story
Five peppers standing in a row on a pink terrazzo ledge against a sunlit pink stucco wall.
The intro hero, generated with nano-banana-pro. Kling animates it into a looping march.

An embeddable ten-question quiz for Tonic Site Shop's Spring '26 campaign that sorts a brand's voice into one of five peppers. Every generated image came from two models held to one reference image, and each result ends in share cards made to be posted.

The problem

Tonic Site Shop’s Spring ’26 campaign, “Fortune Favors the Spicy,” needed a quiz: ten questions that sort a brand’s voice into one of five peppers, a result held behind an email, and something people would want to post. Tonic’s team wrote the brief and the copy. The campaign already had a look: cream, spicy red, editorial serif, and an image of peppers on pink stucco. The quiz had to sit inside a Showit page, read as part of that campaign, and keep working after launch.

The imagery was the hard part. Each question needed two images, plus a hero and five pepper portraits, and all of them had to look shot by one photographer in the same afternoon light. The deadline was as soon as possible, with quality over speed.

What I built

A Vite and vanilla JS quiz on Cloudflare Pages, on its own subdomain, embedded with one script tag. The tag opens a fullscreen overlay over the host page. Showit wraps embed code in its own iframe, which swallows clicks, so the trigger link targets the top window and the loader listens for the hash change.

Ten questions, with answer order shuffled once per session. Each question sits between two generated stills. Then a name and email gate, then a long editorial result page for the pepper: the reading, three moves for this week, and a breakdown of how your answers split across all five peppers.

Then the share cards. Two 1080×1920 story cards are rendered from an HTML template with headless Chrome. A third is drawn on canvas in the browser from your own scores. On phones, Download opens the native share sheet so the cards land in the camera roll. On desktop it zips them with a small inline encoder.

Behind it, Pages Functions subscribe the visitor to Kit and set their pepper as a custom field, which drives a personalized results email. Kit keeps only the final pepper, so every submission’s ten answers are also logged to D1. An internal dashboard turns them into a question-by-pepper heatmap, built to catch a question that pulls everyone toward one pepper.

How I built it with AI

Claude Code wrote most of the code: 56 of the 59 non-merge commits carry its co-author line. I directed it and fed in the team’s feedback passes. Work landed on a dev branch, with preview deploys, before it merged to production.

The image pipeline ran in the same sessions. Claude called Replicate directly: google/nano-banana-pro for stills, Kling v2.1 for image-to-video. Three rules kept the set consistent:

  • One reference on every call. At the start of each batch, the campaign’s pink-stucco pepper image is uploaded and passed as image_input on every generation. Without it, nano-banana-pro drifted to a dustier pink.
  • A fixed prompt opener. Every still prompt starts with the same block: use the reference as a strict color and texture guide, don’t edit it, make a new composition. Then comes the scene, then the constants: hard diagonal afternoon light from the upper left, long soft shadows, scattered chili flakes, no legible text.
  • Two models, no switching. The set only matches if it stays in one model’s visual voice.

Kling only animates forward from a start frame. I wanted the hero peppers to march in and out on a loop. So Claude prompted the reverse motion, flipped the clip with ffmpeg, and joined the reversed and forward clips into a ping-pong loop whose seams match frame for frame.

On day three I had Claude write the whole pipeline into the repo’s CLAUDE.md as a runbook. It covers the upload, the prompt template, polling, a parsing gotcha in Replicate’s responses, rate limits, the ffmpeg recipes and where files go. A fresh session can regenerate any asset without me explaining anything. That paid off the same day: the team rewrote Q1 and Q8, the old accents now showed the wrong scenes, and both pairs were regenerated to match.

Whenever the copy changed, Claude ran 10,000 random answer sequences through the scorer to confirm each pepper still landed between 18 and 22 percent.

Where AI stayed out

The words. The questions, the pepper readings, the results email and the campaign brief came from Tonic’s team, over three copy revisions. When Claude applied a revision, it used the copy word for word and listed every liberty it took, such as a fixed typo or a cut-off line kept from the last version, so the team could overrule it. The brand voice wasn’t generated.

Text inside images. Every prompt asks for no legible text. The share cards are set in HTML with the campaign fonts and then screenshotted. Generated art supplies only the pepper portraits. Image models misspell, and a share card with a misspelled pepper name won’t get posted.

What the scoring should reward. The original spec counted Q10 double. A team member reported someone they knew as a clear Thai Chili coming out Ghost Pepper. Claude traced the mechanism: the double weight turned a three-to-two majority into a tie, and the tiebreaker then handed it to the Q10 pick. What Q10 was for wasn’t a question for a model. The team meant it as the honest signal, so it stayed as the tiebreaker and lost only the double weight. Then we replayed the likely answer set and re-ran the simulation.

Motion that didn’t earn its place. The first Q1 accent was a looping video; when the question changed, it became a still because the new composition didn’t need motion. The hero is the only video in production.

Where it is now

Still live at spice-quiz.tonicsiteshop.com. It was first deployed on April 22, and the last change was on May 11. After launch I stopped adding quiz takers to the launch waitlist automatically, so the quiz could run long term without muddying campaign reporting. The image runbook stays in the repo, so the campaign’s look can be rebuilt on demand, not from memory.

  • 56 of 59Non-merge commits co-authored by Claude
  • 26Generated stills in production
  • 10,000Simulated runs per scoring check

A project, over time.

The milestones that shaped it, in order.

  1. First deploy

    Scaffolded the embeddable quiz and deployed it to its own subdomain, with the Kit signup verified end to end.

  2. Generated imagery lands

    Twenty question accents and the hero still from nano-banana-pro, the hero loop from Kling, and the embed reworked into a fullscreen overlay.

  3. Pipeline written down

    The full Replicate and ffmpeg workflow went into the repo as a runbook. Q1 and Q8 were regenerated to match rewritten copy.

  4. Story share cards

    Generated pepper portraits composed into 1080×1920 cards from an HTML template, downloaded together as one file.

  5. Showit embed and answer log

    A cross-frame trigger for Showit's embed boxes, and every answer logged to D1 behind an internal dashboard.

  6. Scoring rebalanced

    Dropped the double weight on Q10 after a reported misclassification. Kept Q10 as the tiebreaker and re-ran 10,000 simulated quizzes.

  7. Third share card

    A spice-profile card drawn on canvas in the browser from the visitor's own answers.

  8. Set up to run long term

    Quiz takers stopped being auto-added to the launch waitlist, so the two audiences stay separate in reporting.