Skip to main content
Cookbook Marketing

Build a Branching Quiz Lead Magnet with AI

Describe your quiz in plain English and get a working branching lead magnet that files every result into the right email group.

Difficulty Intermediate
Time ~20 min
Tools code_snippet, rest_api

Prerequisites

A connected site, the free WPCode plugin installed and active, and an email marketing account (MailerLite or similar) with a group and an embedded form for each quiz result

The prompt
Build a branching quiz lead magnet on my WordPress site using a WPCode snippet, then embed it on a draft page.

My quiz:
- Quiz title: [quiz title]
- Questions and branching: [describe each question, its answer options, and which question or result each answer leads to]
- Results: [list each result with a title and a one-line result text]
- Email capture: each result should sign people up to its own group or segment in my email tool. I use [MailerLite / other email service]. Below are the embed codes for one form per result, copied from my email tool (in MailerLite: Forms, then Embedded, copy the HTML). Extract the subscribe address you need from each embed code yourself. If I have not pasted embed codes or something looks missing, walk me through where to find them in my tool before you build anything.
[paste result 1 form embed code]
[paste result 2 form embed code]
[paste result 3 form embed code]

Rules:
1. Build the quiz as ONE self-contained WPCode HTML snippet (vanilla JavaScript, no external libraries, one question shown at a time with buttons for answers) using the on-demand location and shortcode insert method, so I can embed it with a shortcode in any editor or page builder.
2. After I approve the snippet, give me the enable link and wait until I confirm I switched it on.
3. Create the quiz page as a DRAFT with the snippet shortcode in it. Do not publish anything.
4. When a player reaches a result, show its title and text plus an email signup that submits via JavaScript fetch() to that result's MailerLite subscribe endpoint (form-encoded), then shows a thank-you message in place. Never use a native form action, it strands the visitor on a raw JSON page. Include a hidden honeypot field and skip submission if it is filled. If MailerLite double opt-in is on, the thank-you should say to check your inbox to confirm.
5. Escape all quiz text properly, and use the exact subscribe address extracted from the embed code I pasted for that result. Never invent, guess, or reuse an address across results.
6. When you are done, list every possible answer path from the first question to its result (for example: Q1 answer A, then Q2 answer B, then Result X) so I can click through every path on the draft and verify the branching and each signup form before I publish.

Already connected to WPVibe?

Skip the copy-paste. Just ask your AI for the “Build a Branching Quiz Lead Magnet with AI” recipe, or describe the task, and WPVibe runs these steps on your own site.

A branching quiz is the lead magnet everyone wants and almost nobody builds. The logic is real developer work: dozens of answer paths, results that depend on combinations of choices, and one wrong condition quietly sending people to the wrong result. Quiz plugins help, but you still click the branching together by hand, and the job usually lands on a developer’s invoice or stays on the someday list.

The part that makes quizzes hard for a human, keeping every branch straight, is the part AI is genuinely good at. Describe your questions, your branching rules, and your results in plain English, and your AI builds the whole quiz as one self-contained code snippet on your site. The snippet is saved switched off until you review it and turn it on yourself, and the quiz page is created as a draft. Because it embeds with a simple shortcode, the same quiz works in the block editor, Elementor, or any other builder. Each result shows its own signup form wired to the matching group in your email tool, so every quiz taker lands in the right segment and gets the right follow-up automatically.

Before you start, install the free WPCode plugin (your AI writes the quiz into it, but never switches anything on without you) and set up one group and one embedded form per quiz result in your email tool. In MailerLite that is Forms, then Embedded, one form per group, then copy each form’s embed code. You do not need to understand what is inside it: the prompt has you paste the embed codes in whole, and your AI pulls out the address it needs. We wrote and tested this recipe around MailerLite, but the pattern is not picky: if you run a different email service, tell your AI which one and it will tailor the signup step to your provider’s forms, or walk you through finding the embed codes if you are stuck. Then paste the prompt with your quiz filled in. The prompt ends by making your AI list every possible answer path; click through each one on the draft before you publish. That five minutes of clicking is what makes the quiz trustworthy.

Watch it built

Outcome

A draft quiz page where every answer path was clicked and verified, with each result signing visitors up to its matching email group.