How to Build an AI-Powered Diagnostic for a Squarespace Site
Most lead magnets give people something static.
A PDF. A checklist. A guide. A worksheet.
Those can still be useful, but AI makes a different kind of lead magnet possible: one that responds to the person.
Instead of saying, “Download this guide,” you can invite someone to answer a few questions and get a personalized result.
That result might help them see why their website is not communicating clearly, where their offer is confusing, whether their homepage has enough trust, or what kind of lead magnet fits their business.
For Squarespace users, the simplest version does not require a full app, dashboard, login system, or custom software project.
You need three main pieces:
A Squarespace page
A Cloudflare Worker
An OpenAI API key
The Squarespace page displays the form and the result.
The Cloudflare Worker acts as the secure middle layer.
OpenAI generates the personalized diagnosis.
The flow looks like this:
Squarespace form → Cloudflare Worker → OpenAI → result appears on Squarespace
That’s it.
The trick is getting the order right.
Do not start with the code.
Start with the diagnostic.
Step 1: Decide What the Diagnostic Should Help People See
A good diagnostic is not just a quiz.
A quiz usually sorts someone into a category.
A diagnostic helps someone recognize something useful about their situation.
For example, instead of asking:
What kind of website do you have?
You might ask:
Does your website match where your business actually is now?
That question is more useful because it compares two things:
what is true about the business today
and what the website currently communicates
That kind of diagnostic can produce a result someone actually recognizes.
They might discover that their site has a credibility gap, a positioning gap, an offer clarity gap, or a trust gap.
The value is not just the label.
The value is the recognition.
The person should leave thinking:
That explains what I’ve been feeling.
Step 2: Use ChatGPT to Shape the Diagnostic
Before you ask ChatGPT for code, ask it to help you shape the diagnostic.
Start with your plain-language idea.
For example:
I want to create a diagnostic that helps business owners understand whether their website still matches the business they are running now.
Then ask ChatGPT to help you think through the important decisions:
What should this diagnostic help people understand?
Who is it for?
What should the visitor submit?
Should the tool analyze a URL, pasted text, form answers, or some combination?
What questions should it ask?
What result categories would feel useful?
What should the final result include?
What should the visitor do after getting their result?
This first conversation is not about code.
It is about the shape of the diagnostic.
You want to end up with a simple blueprint that includes:
the diagnostic name
the audience
the promise
the form questions
the result categories
the result format
the call to action
the tone of the result
Once those pieces are clear, the technical part gets much easier.
Step 3: Ask ChatGPT to Generate the Technical Setup
After the diagnostic is clear, ask ChatGPT to turn the blueprint into the technical pieces.
For Squarespace, you want it to generate two main things:
Cloudflare Worker code
and Squarespace embed code
The Cloudflare Worker is the backend.
The Squarespace embed is what you paste into a Code Block on your site.
The Worker is important because your OpenAI API key should never go directly inside Squarespace or browser JavaScript.
The Worker protects the key.
So when someone fills out the form on your Squarespace page, the form sends the information to the Worker. The Worker sends it to OpenAI. OpenAI returns the result. The Worker sends the result back to the Squarespace page.
The visitor only sees the form and the result.
They never see the API key.
Step 4: Set Up Cloudflare and OpenAI
Create a Cloudflare account and go to Workers & Pages.
Create a new Worker. You can start with the default “Hello World” Worker.
Then go to the OpenAI platform and create an API key.
Back in Cloudflare, add that OpenAI key as a secret.
The secret is usually named:
OPENAI_API_KEY
Your Worker code will use that secret when it calls OpenAI.
Once the key is saved in Cloudflare, you can paste in the Worker code ChatGPT generated and deploy it.
Cloudflare will give you a Worker URL.
You will need that URL for the Squarespace embed.
Step 5: Add the Embed to Squarespace
Next, take the Squarespace embed code ChatGPT generated.
Inside that code, there should be a placeholder for your Worker URL.
Replace the placeholder with the real Worker URL from Cloudflare.
Then add the full embed code to a Squarespace Code Block.
That embed usually includes the form, a little styling, the submit behavior, a loading message, and the result area.
Now the Squarespace page has a working diagnostic interface.
Step 6: Test the Full Loop
The first test is not about whether the diagnostic result is perfect.
The first test is whether the whole loop works.
Submit the form.
Make sure the information goes from Squarespace to Cloudflare, from Cloudflare to OpenAI, and then back to Squarespace as a visible result.
Once that works, you can refine.
Maybe the questions need to be sharper.
Maybe the result categories need better names.
Maybe the result sounds too generic.
Maybe the form should show one question at a time instead of everything at once.
Maybe the call to action needs to be clearer.
That is normal.
The first version proves the system works.
The next version improves the experience.
What You Can Build With This
Once you understand the pattern, you can use it for all kinds of interactive lead magnets.
A website alignment diagnostic.
A homepage clarity review.
An offer page audit.
A lead magnet finder.
A service match quiz.
A proposal fit checker.
A portfolio positioning review.
A donation page trust audit.
An AI readiness assessment.
The structure stays mostly the same.
Only the diagnostic changes.
That is what makes this useful for Squarespace.
You are not turning your site into a full application.
You are adding one smart interactive layer to a page.
The Short Version
Here is the whole process in plain English:
Decide what you want the diagnostic to help people see.
Use ChatGPT to shape the questions, result categories, and final result.
Use ChatGPT again to generate the Cloudflare Worker and Squarespace embed.
Add your OpenAI API key to Cloudflare as a secret.
Paste the Worker code into Cloudflare.
Paste the embed code into Squarespace.
Test it.
Then refine.
The order matters:
Design the diagnostic first.
Generate the plumbing second.
Install, test, and refine.
That is the simplest path to building an AI-powered diagnostic on a Squarespace site.