export function marketingWasteQuiz(form: FormTs) {
form.setTitle(() => '📊 Calculate Your Marketing Waste');
// ============ STATE FOR CALCULATIONS ============
const inputs = form.state<{
monthlyBudget: number;
channels: string[];
trackingMaturity: string;
attributionModel: string;
leadQuality: number;
conversionRate: number;
customerValue: number;
campaignTestFrequency: string;
dataCleanup: string;
toolUtilization: number;
}>({
monthlyBudget: 10000,
channels: [],
trackingMaturity: 'basic',
attributionModel: 'lastClick',
leadQuality: 50,
conversionRate: 2,
customerValue: 1000,
campaignTestFrequency: 'rarely',
dataCleanup: 'never',
toolUtilization: 50
});
// ============ WASTE CALCULATIONS ============
const getTrackingWaste = () => {
const i = inputs();
const wasteRates: Record<string, number> = {
none: 0.40, // 40% waste - flying blind
basic: 0.25, // 25% waste - missing key data
intermediate: 0.12, // 12% waste - some gaps
advanced: 0.05 // 5% waste - well-tracked
};
return Math.round(i.monthlyBudget * (wasteRates[i.trackingMaturity] || 0.25));
};
const getAttributionWaste = () => {
const i = inputs();
const wasteRates: Record<string, number> = {
none: 0.20, // Guessing where leads come from
lastClick: 0.12, // Missing early touchpoints
firstClick: 0.12, // Missing closing touchpoints
multiTouch: 0.04 // More accurate
};
return Math.round(i.monthlyBudget * (wasteRates[i.attributionModel] || 0.15));
};
const getLeadQualityWaste = () => {
const i = inputs();
// If only 50% of leads are qualified, 50% of lead gen spend is wasted
const unqualifiedRate = (100 - i.leadQuality) / 100;
return Math.round(i.monthlyBudget * 0.4 * unqualifiedRate); // Assume 40% of budget is lead gen
};
const getTestingWaste = () => {
const i = inputs();
const wasteRates: Record<string, number> = {
never: 0.15, // Running same campaigns forever
rarely: 0.10, // Occasional optimization
monthly: 0.05, // Regular testing
continuous: 0.02 // Always optimizing
};
return Math.round(i.monthlyBudget * (wasteRates[i.campaignTestFrequency] || 0.10));
};
const getDataQualityWaste = () => {
const i = inputs();
const wasteRates: Record<string, number> = {
never: 0.12, // Bad data = bad targeting
quarterly: 0.06,
monthly: 0.03,
continuous: 0.01
};
return Math.round(i.monthlyBudget * (wasteRates[i.dataCleanup] || 0.08));
};
const getToolUnderutilizationWaste = () => {
const i = inputs();
// Assume 20% of budget goes to tools
const toolBudget = i.monthlyBudget * 0.20;
const unutilizedRate = (100 - i.toolUtilization) / 100;
return Math.round(toolBudget * unutilizedRate);
};
const getTotalMonthlyWaste = () => {
return getTrackingWaste() + getAttributionWaste() + getLeadQualityWaste() +
getTestingWaste() + getDataQualityWaste() + getToolUnderutilizationWaste();
};
const getAnnualWaste = () => getTotalMonthlyWaste() * 12;
const getWastePercentage = () => {
const i = inputs();
if (i.monthlyBudget === 0) return 0;
return Math.round((getTotalMonthlyWaste() / i.monthlyBudget) * 100);
};
const getEfficiencyGrade = (): 'A' | 'B' | 'C' | 'D' | 'F' => {
const pct = getWastePercentage();
if (pct <= 15) return 'A';
if (pct <= 25) return 'B';
if (pct <= 35) return 'C';
if (pct <= 50) return 'D';
return 'F';
};
const formatCurrency = (val: number) => {
return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }).format(val);
};
// ============ COMPLETION SCREEN ============
form.configureCompletionScreen({
type: 'text',
title: () => `Marketing Efficiency Grade: ${getEfficiencyGrade()}`,
message: () => `Your marketing is wasting approximately ${formatCurrency(getTotalMonthlyWaste())} per month (${getWastePercentage()}% of budget).\n\nThat's ${formatCurrency(getAnnualWaste())} annually in preventable waste.\n\nYour detailed efficiency report includes specific recommendations to reclaim this budget.`
});
// ============ PAGES SETUP ============
const pages = form.addPages('quiz-pages', {
heightMode: 'current-page'
});
// ============ PAGE 1: Budget Overview ============
const page1 = pages.addPage('budget-overview', { mobileBreakpoint: 500 });
page1.addRow(row => {
row.addTextPanel('header1', {
label: 'Step 1 of 5: Budget Overview',
computedValue: () => 'Let\'s understand your marketing investment',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page1.addSpacer({ height: '24px' });
page1.addRow(row => {
row.addMoney('monthlyBudget', {
label: 'What is your total monthly marketing budget?',
isRequired: true,
currency: '$',
min: 1000,
max: 10000000,
placeholder: '25,000',
onValueChange: (val) => {
inputs.update(i => ({ ...i, monthlyBudget: val || 0 }));
}
});
});
page1.addRow(row => {
row.addSuggestionChips('channels', {
label: 'Which marketing channels do you use? (Select all that apply)',
isRequired: true,
min: 1,
suggestions: [
{ id: 'ppc', name: '🔍 Paid Search (PPC)' },
{ id: 'social', name: '📱 Paid Social' },
{ id: 'display', name: '🖼️ Display/Programmatic' },
{ id: 'email', name: '📧 Email Marketing' },
{ id: 'content', name: '✍️ Content Marketing' },
{ id: 'seo', name: '🔎 SEO' },
{ id: 'events', name: '🎪 Events/Trade Shows' },
{ id: 'affiliate', name: '🤝 Affiliate/Partner' }
],
onValueChange: (val) => {
inputs.update(i => ({ ...i, channels: val || [] }));
}
});
});
page1.addRow(row => {
row.addTextPanel('budgetContext', {
computedValue: () => {
const budget = inputs().monthlyBudget;
if (budget < 5000) return '💡 Tip: With smaller budgets, focus is key. Spreading too thin increases waste.';
if (budget < 25000) return '💡 Tip: Mid-sized budgets benefit most from proper tracking and testing.';
if (budget < 100000) return '💡 Tip: At this level, even 5% waste is significant. Advanced attribution pays off.';
return '💡 Tip: Enterprise budgets require sophisticated measurement to prevent substantial waste.';
},
customStyles: {
fontSize: '0.85rem',
color: '#6b7280',
fontStyle: 'italic',
padding: '10px',
background: '#f3f4f6',
borderRadius: '6px',
marginTop: '1rem'
}
});
});
// ============ PAGE 2: Tracking & Attribution ============
const page2 = pages.addPage('tracking', { mobileBreakpoint: 500 });
page2.addRow(row => {
row.addTextPanel('header2', {
label: 'Step 2 of 5: Tracking & Attribution',
computedValue: () => 'How well do you measure marketing performance?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page2.addSpacer({ height: '24px' });
page2.addRow(row => {
row.addRadioButton('trackingMaturity', {
label: 'How would you describe your marketing tracking capabilities?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'none', name: '😰 None - We don\'t really track marketing performance' },
{ id: 'basic', name: '😐 Basic - Google Analytics, some UTM tags' },
{ id: 'intermediate', name: '🙂 Intermediate - CRM integration, conversion tracking' },
{ id: 'advanced', name: '😀 Advanced - Full funnel tracking, marketing automation' }
],
onValueChange: (val) => {
inputs.update(i => ({ ...i, trackingMaturity: val || 'basic' }));
}
});
});
page2.addRow(row => {
row.addRadioButton('attributionModel', {
label: 'What attribution model do you use?',
isRequired: true,
orientation: 'vertical',
tooltip: 'Attribution determines which marketing touchpoints get credit for conversions',
options: [
{ id: 'none', name: '🤷 None - We don\'t have attribution' },
{ id: 'lastClick', name: '👆 Last Click - Credit goes to final touchpoint' },
{ id: 'firstClick', name: '👇 First Click - Credit goes to first touchpoint' },
{ id: 'multiTouch', name: '🔗 Multi-Touch - Credit distributed across touchpoints' }
],
onValueChange: (val) => {
inputs.update(i => ({ ...i, attributionModel: val || 'lastClick' }));
}
});
});
page2.addRow(row => {
row.addTextPanel('trackingWastePreview', {
computedValue: () => {
const tracking = getTrackingWaste();
const attribution = getAttributionWaste();
return `📉 Estimated waste from tracking gaps: ${formatCurrency(tracking + attribution)}/month`;
},
customStyles: {
fontSize: '0.95rem',
fontWeight: '600',
color: '#dc2626',
textAlign: 'center',
padding: '12px',
background: '#fef2f2',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 3: Lead Quality & Conversion ============
const page3 = pages.addPage('lead-quality', { mobileBreakpoint: 500 });
page3.addRow(row => {
row.addTextPanel('header3', {
label: 'Step 3 of 5: Lead Quality & Conversion',
computedValue: () => 'How effective is your lead generation?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page3.addSpacer({ height: '24px' });
page3.addRow(row => {
row.addSlider('leadQuality', {
label: 'What percentage of your marketing leads are actually qualified?',
isRequired: true,
min: 10,
max: 90,
step: 5,
defaultValue: 50,
showValue: true,
unit: '%',
tooltip: 'Qualified = meets your ICP and has budget/authority/need',
onValueChange: (val) => {
inputs.update(i => ({ ...i, leadQuality: val || 50 }));
}
});
});
page3.addRow(row => {
row.addSlider('conversionRate', {
label: 'What\'s your average lead-to-customer conversion rate?',
isRequired: true,
min: 0.5,
max: 20,
step: 0.5,
defaultValue: 2,
showValue: true,
unit: '%',
onValueChange: (val) => {
inputs.update(i => ({ ...i, conversionRate: val || 2 }));
}
});
});
page3.addRow(row => {
row.addMoney('customerValue', {
label: 'Average customer lifetime value (LTV):',
isRequired: true,
currency: '$',
min: 100,
max: 1000000,
placeholder: '5,000',
onValueChange: (val) => {
inputs.update(i => ({ ...i, customerValue: val || 1000 }));
}
});
});
page3.addRow(row => {
row.addTextPanel('leadQualityWastePreview', {
computedValue: () => {
const waste = getLeadQualityWaste();
const quality = inputs().leadQuality;
return `📉 ${100 - quality}% unqualified leads = ${formatCurrency(waste)}/month in wasted spend`;
},
customStyles: {
fontSize: '0.95rem',
fontWeight: '600',
color: '#dc2626',
textAlign: 'center',
padding: '12px',
background: '#fef2f2',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 4: Optimization Practices ============
const page4 = pages.addPage('optimization', { mobileBreakpoint: 500 });
page4.addRow(row => {
row.addTextPanel('header4', {
label: 'Step 4 of 5: Optimization Practices',
computedValue: () => 'How do you improve marketing performance?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page4.addSpacer({ height: '24px' });
page4.addRow(row => {
row.addRadioButton('campaignTestFrequency', {
label: 'How often do you test and optimize campaigns?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'never', name: '😰 Never - Set and forget' },
{ id: 'rarely', name: '😐 Rarely - Only when performance tanks' },
{ id: 'monthly', name: '🙂 Monthly - Regular optimization cycles' },
{ id: 'continuous', name: '😀 Continuous - Always running A/B tests' }
],
onValueChange: (val) => {
inputs.update(i => ({ ...i, campaignTestFrequency: val || 'rarely' }));
}
});
});
page4.addRow(row => {
row.addRadioButton('dataCleanup', {
label: 'How often do you clean up your marketing data/lists?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'never', name: '😰 Never - Our lists grow forever' },
{ id: 'quarterly', name: '😐 Quarterly - Basic cleanup' },
{ id: 'monthly', name: '🙂 Monthly - Regular hygiene' },
{ id: 'continuous', name: '😀 Continuous - Automated cleanup rules' }
],
onValueChange: (val) => {
inputs.update(i => ({ ...i, dataCleanup: val || 'never' }));
}
});
});
page4.addRow(row => {
row.addSlider('toolUtilization', {
label: 'What percentage of your martech tools\' features do you actually use?',
isRequired: true,
min: 10,
max: 100,
step: 10,
defaultValue: 50,
showValue: true,
unit: '%',
tooltip: 'Most companies use less than 30% of their marketing tools\' capabilities',
onValueChange: (val) => {
inputs.update(i => ({ ...i, toolUtilization: val || 50 }));
}
});
});
page4.addRow(row => {
row.addTextPanel('optimizationWastePreview', {
computedValue: () => {
const testing = getTestingWaste();
const data = getDataQualityWaste();
const tools = getToolUnderutilizationWaste();
return `📉 Optimization gaps waste: ${formatCurrency(testing + data + tools)}/month`;
},
customStyles: {
fontSize: '0.95rem',
fontWeight: '600',
color: '#dc2626',
textAlign: 'center',
padding: '12px',
background: '#fef2f2',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 5: Results ============
const page5 = pages.addPage('results', { mobileBreakpoint: 500 });
page5.addRow(row => {
row.addTextPanel('header5', {
label: 'Step 5 of 5: Your Marketing Waste Analysis',
computedValue: () => 'Here\'s how much budget you could reclaim',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page5.addSpacer({ height: '24px' });
// Efficiency grade
page5.addRow(row => {
row.addTextPanel('efficiencyGrade', {
label: 'Marketing Efficiency Grade',
computedValue: () => getEfficiencyGrade(),
customStyles: () => {
const grade = getEfficiencyGrade();
const colors: Record<string, string> = {
A: '#16a34a',
B: '#65a30d',
C: '#ca8a04',
D: '#ea580c',
F: '#dc2626'
};
return {
fontSize: '3rem',
fontWeight: '800',
color: colors[grade],
textAlign: 'center',
padding: '20px',
background: '#f9fafb',
borderRadius: '12px',
border: `4px solid ${colors[grade]}`
};
}
});
});
page5.addRow(row => {
row.addTextPanel('totalMonthlyWaste', {
label: '💸 Monthly Marketing Waste',
computedValue: () => formatCurrency(getTotalMonthlyWaste()),
customStyles: {
fontSize: '1.8rem',
fontWeight: '700',
color: '#dc2626',
textAlign: 'center',
padding: '15px',
background: '#fef2f2',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
page5.addRow(row => {
row.addTextPanel('wasteStats', {
computedValue: () => `${getWastePercentage()}% of your ${formatCurrency(inputs().monthlyBudget)} monthly budget`,
customStyles: {
fontSize: '1rem',
color: '#4b5563',
textAlign: 'center',
marginTop: '5px'
}
});
});
page5.addRow(row => {
row.addTextPanel('annualWaste', {
computedValue: () => `Annual waste: ${formatCurrency(getAnnualWaste())}`,
customStyles: {
fontSize: '1.2rem',
fontWeight: '600',
color: '#7c3aed',
textAlign: 'center',
padding: '12px',
background: '#f5f3ff',
borderRadius: '8px',
marginTop: '15px'
}
});
});
// Waste breakdown
const breakdownSection = page5.addSubform('breakdown', {
title: '📊 Waste Breakdown by Category',
isCollapsible: true,
customStyles: {
marginTop: '1.5rem',
background: '#f9fafb',
borderRadius: '8px'
}
});
breakdownSection.addRow(row => {
row.addTextPanel('trackingLine', {
label: '📈 Tracking Gaps',
computedValue: () => formatCurrency(getTrackingWaste()),
customStyles: { padding: '8px 12px', background: '#fef2f2', borderRadius: '6px', marginBottom: '8px' }
}, '1fr');
row.addTextPanel('attributionLine', {
label: '🔗 Attribution Model',
computedValue: () => formatCurrency(getAttributionWaste()),
customStyles: { padding: '8px 12px', background: '#fef2f2', borderRadius: '6px', marginBottom: '8px' }
}, '1fr');
});
breakdownSection.addRow(row => {
row.addTextPanel('leadQualityLine', {
label: '👥 Unqualified Leads',
computedValue: () => formatCurrency(getLeadQualityWaste()),
customStyles: { padding: '8px 12px', background: '#fef2f2', borderRadius: '6px', marginBottom: '8px' }
}, '1fr');
row.addTextPanel('testingLine', {
label: '🧪 Lack of Testing',
computedValue: () => formatCurrency(getTestingWaste()),
customStyles: { padding: '8px 12px', background: '#fef2f2', borderRadius: '6px', marginBottom: '8px' }
}, '1fr');
});
breakdownSection.addRow(row => {
row.addTextPanel('dataLine', {
label: '🗃️ Data Quality',
computedValue: () => formatCurrency(getDataQualityWaste()),
customStyles: { padding: '8px 12px', background: '#fef2f2', borderRadius: '6px', marginBottom: '8px' }
}, '1fr');
row.addTextPanel('toolsLine', {
label: '🛠️ Tool Underutilization',
computedValue: () => formatCurrency(getToolUnderutilizationWaste()),
customStyles: { padding: '8px 12px', background: '#fef2f2', borderRadius: '6px', marginBottom: '8px' }
}, '1fr');
});
// ============ PAGE 6: Lead Capture ============
const page6 = pages.addPage('lead-capture', { mobileBreakpoint: 500 });
page6.addRow(row => {
row.addTextPanel('header6', {
label: 'Step 6 of 6: Get Your Efficiency Report',
computedValue: () => 'Enter your details to receive actionable recommendations',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page6.addSpacer({ height: '24px' });
page6.addRow(row => {
row.addTextbox('name', {
label: 'Your Name',
isRequired: true,
placeholder: 'Jane Marketer'
}, '1fr');
row.addEmail('email', {
label: 'Work Email',
isRequired: true,
placeholder: 'jane@company.com'
}, '1fr');
});
page6.addRow(row => {
row.addTextbox('company', {
label: 'Company Name',
placeholder: 'Growth Co'
}, '1fr');
row.addDropdown('role', {
label: 'Your Role',
options: [
{ id: 'cmo', name: 'CMO / Marketing Director' },
{ id: 'manager', name: 'Marketing Manager' },
{ id: 'specialist', name: 'Marketing Specialist' },
{ id: 'founder', name: 'Founder / CEO' },
{ id: 'agency', name: 'Agency / Consultant' }
],
placeholder: 'Select your role'
}, '1fr');
});
page6.addRow(row => {
row.addCheckboxList('consent', {
options: [
{
id: 'report',
name: '📄 Send me the marketing efficiency report',
isRequired: true
},
{
id: 'tips',
name: '💡 Send me weekly marketing optimization tips'
},
{
id: 'audit',
name: '📞 I\'d like a free marketing efficiency audit'
}
],
defaultValue: ['report'],
orientation: 'vertical'
});
});
// ============ PDF REPORT ============
form.configurePdf('marketing-waste-report', pdf => {
pdf.configure({
filename: 'marketing-efficiency-report.pdf',
pageSize: 'A4',
allowUserDownload: true,
downloadButtonLabel: '📄 Download Efficiency Report',
header: {
title: 'Marketing Efficiency Analysis',
subtitle: 'Waste Identification & Reclamation Strategies'
},
footer: {
text: 'Generated by FormTs Marketing Waste Calculator',
showPageNumbers: true
}
});
pdf.addSection('Executive Summary', section => {
section.addRow(row => {
row.addField('Efficiency Grade', getEfficiencyGrade());
row.addField('Waste Percentage', `${getWastePercentage()}%`);
});
section.addRow(row => {
row.addField('Monthly Waste', formatCurrency(getTotalMonthlyWaste()));
row.addField('Annual Waste', formatCurrency(getAnnualWaste()));
});
section.addRow(row => {
row.addField('Monthly Budget', formatCurrency(inputs().monthlyBudget));
row.addField('Channels', `${inputs().channels.length} active`);
});
});
pdf.addSection('Waste Breakdown', section => {
section.addTable(
['Category', 'Monthly Waste', 'Annual Waste', '% of Total'],
[
['Tracking Gaps', formatCurrency(getTrackingWaste()), formatCurrency(getTrackingWaste() * 12), `${Math.round((getTrackingWaste() / getTotalMonthlyWaste()) * 100)}%`],
['Attribution Issues', formatCurrency(getAttributionWaste()), formatCurrency(getAttributionWaste() * 12), `${Math.round((getAttributionWaste() / getTotalMonthlyWaste()) * 100)}%`],
['Unqualified Leads', formatCurrency(getLeadQualityWaste()), formatCurrency(getLeadQualityWaste() * 12), `${Math.round((getLeadQualityWaste() / getTotalMonthlyWaste()) * 100)}%`],
['Lack of Testing', formatCurrency(getTestingWaste()), formatCurrency(getTestingWaste() * 12), `${Math.round((getTestingWaste() / getTotalMonthlyWaste()) * 100)}%`],
['Data Quality', formatCurrency(getDataQualityWaste()), formatCurrency(getDataQualityWaste() * 12), `${Math.round((getDataQualityWaste() / getTotalMonthlyWaste()) * 100)}%`],
['Tool Underutilization', formatCurrency(getToolUnderutilizationWaste()), formatCurrency(getToolUnderutilizationWaste() * 12), `${Math.round((getToolUnderutilizationWaste() / getTotalMonthlyWaste()) * 100)}%`]
]
);
});
pdf.addPageBreak();
pdf.addSection('Priority Recommendations', section => {
const grade = getEfficiencyGrade();
if (inputs().trackingMaturity === 'none' || inputs().trackingMaturity === 'basic') {
section.addText('1. TRACKING UPGRADE (High Priority)');
section.addText(' - Implement proper conversion tracking across all channels');
section.addText(' - Use UTM parameters consistently');
section.addText(' - Estimated recovery: ' + formatCurrency(getTrackingWaste()) + '/month');
section.addSpacer(10);
}
if (inputs().leadQuality < 60) {
section.addText('2. LEAD QUALITY IMPROVEMENT (High Priority)');
section.addText(' - Tighten targeting criteria and add qualification forms');
section.addText(' - Implement lead scoring before sales handoff');
section.addText(' - Estimated recovery: ' + formatCurrency(getLeadQualityWaste()) + '/month');
section.addSpacer(10);
}
if (inputs().campaignTestFrequency === 'never' || inputs().campaignTestFrequency === 'rarely') {
section.addText('3. TESTING PROGRAM (Medium Priority)');
section.addText(' - Implement monthly A/B testing schedule');
section.addText(' - Test headlines, CTAs, landing pages, and audiences');
section.addText(' - Estimated recovery: ' + formatCurrency(getTestingWaste()) + '/month');
section.addSpacer(10);
}
section.addText('4. QUICK WINS');
section.addText(' - Clean email lists (remove inactive subscribers)');
section.addText(' - Audit martech stack for unused features');
section.addText(' - Review and pause underperforming campaigns');
});
pdf.addSection('Industry Benchmarks', section => {
section.addText('Average marketing waste by company size:');
section.addTable(
['Company Size', 'Avg Waste %', 'Your Waste %'],
[
['Small (<50 employees)', '35-45%', `${getWastePercentage()}%`],
['Medium (50-500)', '25-35%', `${getWastePercentage()}%`],
['Enterprise (500+)', '15-25%', `${getWastePercentage()}%`]
]
);
});
});
// ============ SUBMIT BUTTON ============
form.configureSubmitButton({
label: () => `📄 Get My Efficiency Report (Grade: ${getEfficiencyGrade()})`
});
form.configureSubmitBehavior({
sendToServer: true
});
}