Use case: Customer segmentation and campaign recommendations
Can you use data on 800 existing customer accounts to identify opportunities for retention, engagement, and revenue growth? Use Claude Code to develop targeted campaign recommendations and present your findings in an HTML dashboard.
1. The business challenge
You're a growth marketer at a B2B SaaS company with 800 existing customer accounts. The data contains no prospective customers or sales leads. Your marketing director wants to move beyond generic customer communications and launch targeted campaigns to improve customer retention, engagement, or revenue. You have customer account and usage data, but no existing customer segments.
For tomorrow's planning meeting, she wants you to identify three actionable customer segments and recommend two campaigns to prioritize. For each segment, she wants to understand:
- Who belongs in it and how many customers it includes
- What makes those customers distinct and why the segment matters
- What marketing message might resonate with them
- Which outreach channel you recommend, and why
Present your analysis and recommendations in a clear, visually appealing HTML dashboard that the marketing director can open in a web browser. The dashboard communicates your findings to the director, who will act on the analysis and recommendations behind it.
2. Your starting data
Download the sample dataset (800 rows) and save it as customers.csv in a new folder named customer-segmentation.
Each row represents an existing customer account. The data includes customer characteristics, current subscription revenue, recent product activity, support history, and assigned customer success managers. Its fields are:
customer_id, company_name, industry, employee_count,
plan_tier, mrr_usd, signup_date, last_login_days_ago,
features_used_30d, support_tickets_90d, csm_assigned
As in real business data, not everything is perfectly clean. For example, industry labels vary, plan names are inconsistently capitalized, and some employee counts are missing. You don't need to clean the file manually.
Keep the data's limits in mind: It provides a snapshot of customers and their activity, but not historical campaign results or confirmed churn outcomes. You can identify promising targets for upselling, re-engagement, or retention, but should not claim to know which campaign will perform best without further evidence.
3. Build it with Claude Code
- Open your folder in VS Code. Make sure
customers.csvis inside, then start Claude Code in that folder. - Write your own prompt. Explain the business challenge, what data Claude Code can use, and what you want it to produce. You decide how much detail to provide. There is no model prompt to copy.
- Let the agent work. Claude Code may inspect the CSV, write and run analysis code, and create output files. Review any actions or permissions it asks you to approve.
- Open the result. Find the generated
dashboard.htmlin your project folder and open it in your browser. If the agent chose a different filename, ask it to save the dashboard asdashboard.html.
Try starting with a single prompt that describes the whole task. You can always follow up if you want to clarify or change something.
4. Review your analysis and recommendations
Use your dashboard to review the segments and campaign recommendations. Would the marketing director have enough information to decide which two campaigns to run?
- Data: Can you see useful patterns in the customer base, including the ones behind the final segment names?
- Segments: Are the three segments clearly described, with counts and meaningful comparisons?
- Recommendations: Does the dashboard explain the two campaigns it would prioritize and the rationale for each?
- Presentation: Are the charts readable? Can a manager navigate the dashboard without knowing the code?
There is no single correct segmentation or campaign strategy. Different prompts may lead to different analytical choices and recommendations; dashboard design should help make those choices clear.
5. Share, compare, and improve
Pair up with a classmate. Share your dashboards and explain the customer segments you identified, the two campaigns you recommend, and why.
Discuss together:
- Similarities: What do your dashboards and recommendations have in common?
- Differences: How do your segment definitions, charts, campaign priorities, or recommendations differ?
- Improvements: What did you learn from your classmate's approach? What would you change about your own dashboard or recommendations?
Use what you learned to ask Claude Code to improve your segmentation, recommendations, or their presentation. Open the updated HTML file and review the changes.
6. Reflect
Before moving on, think about these questions:
- What did your first prompt accomplish? What, if anything, required a follow-up?
- What files did Claude Code create or modify in your local project folder?
- Which decisions did you leave to AI, and which did you make yourself?
- How would you check whether its segment definitions and marketing recommendations actually make business sense?
Takeaway
You didn't need to write the data-cleaning script, the charts, or the HTML by hand. You described a business objective, and an AI coding agent worked with local files to develop marketing recommendations and present them in a dashboard you could open and revise. In later modules, we'll look more closely at how to verify the analysis and guide larger projects.