export function seoHealthCheckQuiz(form: FormTs) {
form.setTitle(() => '🔍 Rate Your Website in 2 Minutes');
// ============ SCORING SYSTEM ============
const scores = form.state<Record<string, number>>({});
const updateScore = (category: string, points: number) => {
scores.update(current => ({ ...current, [category]: points }));
};
const getTotalScore = () => {
const s = scores();
return Object.values(s).reduce((sum, val) => sum + (val || 0), 0);
};
const getMaxScore = () => 100;
const getScorePercentage = () => Math.round((getTotalScore() / getMaxScore()) * 100);
const getGrade = (): 'A' | 'B' | 'C' | 'D' | 'F' => {
const pct = getScorePercentage();
if (pct >= 90) return 'A';
if (pct >= 75) return 'B';
if (pct >= 60) return 'C';
if (pct >= 40) return 'D';
return 'F';
};
const getGradeLabel = () => {
const grade = getGrade();
const labels = {
A: '🏆 Grade A - Excellent SEO!',
B: '✅ Grade B - Good Foundation',
C: '⚡ Grade C - Needs Improvement',
D: '⚠️ Grade D - Significant Issues',
F: '🚨 Grade F - Critical Problems'
};
return labels[grade];
};
const getGradeColor = () => {
const grade = getGrade();
const colors = {
A: '#16a34a',
B: '#22c55e',
C: '#ca8a04',
D: '#ea580c',
F: '#dc2626'
};
return colors[grade];
};
// ============ COMPLETION SCREEN ============
form.configureCompletionScreen({
type: 'text',
title: () => `${getGradeLabel()}`,
message: () => {
const pct = getScorePercentage();
const grade = getGrade();
const messages = {
A: `Your SEO score is ${pct}%. Excellent work! Your website is well-optimized for search engines. Download your report to maintain this competitive advantage.`,
B: `Your SEO score is ${pct}%. Good foundation! Your site has solid SEO basics but there's room for improvement. Review your personalized recommendations.`,
C: `Your SEO score is ${pct}%. Your website needs optimization work. Several areas require attention to improve your search rankings.`,
D: `Your SEO score is ${pct}%. Significant SEO issues detected. Your website is likely losing valuable organic traffic. Download your action plan.`,
F: `Your SEO score is ${pct}%. Critical SEO problems found. Your website may be invisible to search engines. Immediate action required.`
};
return messages[grade];
}
});
// ============ PAGES SETUP ============
const pages = form.addPages('quiz-pages', {
heightMode: 'current-page'
});
// ============ PAGE 1: Website Basics ============
const page1 = pages.addPage('website-basics', { mobileBreakpoint: 500 });
page1.addRow(row => {
row.addTextPanel('header1', {
label: 'Step 1 of 7: Website Basics',
computedValue: () => 'Tell us about your website to customize the assessment',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page1.addSpacer({ height: '24px' });
page1.addRow(row => {
row.addTextbox('websiteUrl', {
label: 'Website URL',
isRequired: true,
placeholder: 'https://example.com'
}, '1fr');
row.addDropdown('websiteType', {
label: 'Website Type',
isRequired: true,
options: [
{ id: 'ecommerce', name: '🛒 E-commerce / Online Store' },
{ id: 'blog', name: '📝 Blog / Content Site' },
{ id: 'corporate', name: '🏢 Corporate / Business' },
{ id: 'saas', name: '💻 SaaS / Software' },
{ id: 'portfolio', name: '🎨 Portfolio / Personal' },
{ id: 'local', name: '📍 Local Business' },
{ id: 'news', name: '📰 News / Media' },
{ id: 'other', name: '📦 Other' }
],
placeholder: 'Select website type'
}, '1fr');
});
page1.addRow(row => {
row.addDropdown('websiteAge', {
label: 'How old is your website?',
isRequired: true,
options: [
{ id: 'new', name: '🆕 Less than 6 months' },
{ id: '6-12', name: '📅 6-12 months' },
{ id: '1-2', name: '📆 1-2 years' },
{ id: '2-5', name: '🗓️ 2-5 years' },
{ id: '5+', name: '🏛️ More than 5 years' }
],
placeholder: 'Select website age'
}, '1fr');
row.addDropdown('monthlyVisitors', {
label: 'Monthly visitors (estimate)',
isRequired: true,
options: [
{ id: '0-100', name: '📊 0-100' },
{ id: '100-1k', name: '📈 100-1,000' },
{ id: '1k-10k', name: '🚀 1,000-10,000' },
{ id: '10k-100k', name: '💫 10,000-100,000' },
{ id: '100k+', name: '⭐ 100,000+' }
],
placeholder: 'Select range'
}, '1fr');
});
page1.addRow(row => {
row.addSuggestionChips('seoGoals', {
label: 'What are your main SEO goals?',
isRequired: true,
suggestions: [
{ id: 'traffic', name: 'More Traffic' },
{ id: 'rankings', name: 'Better Rankings' },
{ id: 'leads', name: 'More Leads/Sales' },
{ id: 'local', name: 'Local Visibility' },
{ id: 'brand', name: 'Brand Awareness' },
{ id: 'authority', name: 'Industry Authority' }
],
min: 1,
alignment: 'left'
});
});
// ============ PAGE 2: Technical SEO ============
const page2 = pages.addPage('technical-seo', { mobileBreakpoint: 500 });
page2.addRow(row => {
row.addTextPanel('header2', {
label: 'Step 2 of 7: Technical SEO',
computedValue: () => 'How well is your website built for search engines?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page2.addSpacer({ height: '24px' });
page2.addRow(row => {
row.addRadioButton('https', {
label: 'Does your website use HTTPS (secure connection)?',
isRequired: true,
orientation: 'vertical',
tooltip: 'Check if your URL starts with https:// - the padlock icon in your browser indicates a secure connection',
options: [
{ id: 'yes', name: '🔒 Yes, fully secured with HTTPS' },
{ id: 'partial', name: '⚠️ Partially (some pages are HTTP)' },
{ id: 'no', name: '❌ No, using HTTP' },
{ id: 'unknown', name: '🤷 Not sure' }
],
onValueChange: (val) => {
const points = { yes: 10, partial: 4, no: 0, unknown: 2 };
updateScore('https', points[val as keyof typeof points] || 0);
}
});
});
page2.addRow(row => {
row.addRadioButton('mobileOptimized', {
label: 'Is your website mobile-friendly?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'responsive', name: '📱 Fully responsive design' },
{ id: 'mobile-version', name: '📲 Separate mobile version' },
{ id: 'partially', name: '⚠️ Partially mobile-friendly' },
{ id: 'no', name: '❌ Not optimized for mobile' }
],
onValueChange: (val) => {
const points = { responsive: 10, 'mobile-version': 7, partially: 3, no: 0 };
updateScore('mobile', points[val as keyof typeof points] || 0);
}
});
});
page2.addRow(row => {
row.addRadioButton('pageSpeed', {
label: 'How fast does your website load?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'fast', name: '⚡ Very fast (under 2 seconds)' },
{ id: 'average', name: '🚗 Average (2-4 seconds)' },
{ id: 'slow', name: '🐌 Slow (4-6 seconds)' },
{ id: 'very-slow', name: '🦥 Very slow (over 6 seconds)' },
{ id: 'unknown', name: '🤷 Not sure' }
],
onValueChange: (val) => {
const points = { fast: 10, average: 6, slow: 3, 'very-slow': 0, unknown: 3 };
updateScore('speed', points[val as keyof typeof points] || 0);
}
});
});
page2.addRow(row => {
row.addTextPanel('technicalScore', {
computedValue: () => {
const s = scores();
const sectionScore = (s['https'] || 0) + (s['mobile'] || 0) + (s['speed'] || 0);
return `⚙️ Technical SEO Score: ${sectionScore}/30`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 3: On-Page SEO ============
const page3 = pages.addPage('on-page-seo', { mobileBreakpoint: 500 });
page3.addRow(row => {
row.addTextPanel('header3', {
label: 'Step 3 of 7: On-Page SEO',
computedValue: () => 'How well optimized are your pages for search?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page3.addSpacer({ height: '24px' });
page3.addRow(row => {
row.addRadioButton('titleTags', {
label: 'Do your pages have unique, optimized title tags?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'optimized', name: '✅ Yes, unique and keyword-optimized titles on all pages' },
{ id: 'partial', name: '⚠️ Some pages have optimized titles' },
{ id: 'generic', name: '📝 Generic or duplicate titles' },
{ id: 'none', name: '❌ No idea / Never checked' }
],
onValueChange: (val) => {
const points = { optimized: 5, partial: 3, generic: 1, none: 0 };
updateScore('titles', points[val as keyof typeof points] || 0);
}
});
});
page3.addRow(row => {
row.addRadioButton('metaDescriptions', {
label: 'Do your pages have compelling meta descriptions?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'optimized', name: '✅ Yes, unique meta descriptions with calls-to-action' },
{ id: 'partial', name: '⚠️ Some pages have meta descriptions' },
{ id: 'auto', name: '🤖 Auto-generated or missing' },
{ id: 'none', name: '❌ No idea / Never checked' }
],
onValueChange: (val) => {
const points = { optimized: 5, partial: 3, auto: 1, none: 0 };
updateScore('meta', points[val as keyof typeof points] || 0);
}
});
});
page3.addRow(row => {
row.addRadioButton('headings', {
label: 'Do you use proper heading structure (H1, H2, H3)?',
isRequired: true,
orientation: 'vertical',
tooltip: 'Headings help search engines understand your content structure. H1 is the main title, H2 for sections, H3 for subsections.',
options: [
{ id: 'proper', name: '✅ Yes, one H1 per page with logical H2/H3 hierarchy' },
{ id: 'partial', name: '⚠️ Some pages have proper headings' },
{ id: 'inconsistent', name: '😕 Inconsistent heading usage' },
{ id: 'none', name: '❌ No idea / Don\'t use headings strategically' }
],
onValueChange: (val) => {
const points = { proper: 5, partial: 3, inconsistent: 1, none: 0 };
updateScore('headings', points[val as keyof typeof points] || 0);
}
});
});
page3.addRow(row => {
row.addRadioButton('imageOptimization', {
label: 'Are your images optimized (alt text, compression)?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'full', name: '✅ Yes, all images have alt text and are compressed' },
{ id: 'partial', name: '⚠️ Some images are optimized' },
{ id: 'compressed', name: '📸 Only compressed, no alt text' },
{ id: 'none', name: '❌ No image optimization' }
],
onValueChange: (val) => {
const points = { full: 5, partial: 3, compressed: 2, none: 0 };
updateScore('images', points[val as keyof typeof points] || 0);
}
});
});
page3.addRow(row => {
row.addTextPanel('onpageScore', {
computedValue: () => {
const s = scores();
const sectionScore = (s['titles'] || 0) + (s['meta'] || 0) + (s['headings'] || 0) + (s['images'] || 0);
return `📄 On-Page SEO Score: ${sectionScore}/20`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 4: Content Quality ============
const page4 = pages.addPage('content-quality', { mobileBreakpoint: 500 });
page4.addRow(row => {
row.addTextPanel('header4', {
label: 'Step 4 of 7: Content Quality',
computedValue: () => 'Content is king - how valuable is your content?',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page4.addSpacer({ height: '24px' });
page4.addRow(row => {
row.addRadioButton('contentFreshness', {
label: 'How often do you publish or update content?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'weekly', name: '📝 Weekly or more frequently' },
{ id: 'monthly', name: '📅 Monthly' },
{ id: 'quarterly', name: '📆 Every few months' },
{ id: 'rarely', name: '❌ Rarely or never' }
],
onValueChange: (val) => {
const points = { weekly: 5, monthly: 4, quarterly: 2, rarely: 0 };
updateScore('freshness', points[val as keyof typeof points] || 0);
}
});
});
page4.addRow(row => {
row.addRadioButton('keywordResearch', {
label: 'Do you conduct keyword research before creating content?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'systematic', name: '🔍 Yes, systematic research for every piece' },
{ id: 'sometimes', name: '⚡ Sometimes' },
{ id: 'basic', name: '🎯 Basic/intuitive approach' },
{ id: 'never', name: '❌ Never' }
],
onValueChange: (val) => {
const points = { systematic: 5, sometimes: 3, basic: 1, never: 0 };
updateScore('keywords', points[val as keyof typeof points] || 0);
}
});
});
page4.addRow(row => {
row.addRadioButton('contentLength', {
label: 'What\'s the average length of your main content pages?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'comprehensive', name: '📚 1,500+ words (comprehensive guides)' },
{ id: 'medium', name: '📄 500-1,500 words' },
{ id: 'short', name: '📝 Under 500 words' },
{ id: 'minimal', name: '⚠️ Mostly images/videos with minimal text' }
],
onValueChange: (val) => {
const points = { comprehensive: 5, medium: 4, short: 2, minimal: 1 };
updateScore('length', points[val as keyof typeof points] || 0);
}
});
});
page4.addRow(row => {
row.addRadioButton('uniqueContent', {
label: 'Is all your content original and unique?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'all', name: '✅ 100% original content' },
{ id: 'mostly', name: '📝 Mostly original with some curated content' },
{ id: 'mixed', name: '⚠️ Mix of original and duplicated content' },
{ id: 'duplicate', name: '❌ Lots of copied/duplicated content' }
],
onValueChange: (val) => {
const points = { all: 5, mostly: 3, mixed: 1, duplicate: 0 };
updateScore('unique', points[val as keyof typeof points] || 0);
}
});
});
page4.addRow(row => {
row.addTextPanel('contentScore', {
computedValue: () => {
const s = scores();
const sectionScore = (s['freshness'] || 0) + (s['keywords'] || 0) + (s['length'] || 0) + (s['unique'] || 0);
return `📝 Content Quality Score: ${sectionScore}/20`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 5: Backlinks & Authority ============
const page5 = pages.addPage('backlinks-authority', { mobileBreakpoint: 500 });
page5.addRow(row => {
row.addTextPanel('header5', {
label: 'Step 5 of 7: Backlinks & Authority',
computedValue: () => 'Links from other sites are crucial for rankings',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page5.addSpacer({ height: '24px' });
page5.addRow(row => {
row.addRadioButton('backlinkStrategy', {
label: 'Do you actively work on getting backlinks?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'active', name: '🔗 Yes, active link building strategy' },
{ id: 'passive', name: '📰 Passive (guest posts, PR occasionally)' },
{ id: 'organic', name: '🌱 Only organic/natural links' },
{ id: 'none', name: '❌ No link building efforts' }
],
onValueChange: (val) => {
const points = { active: 5, passive: 4, organic: 2, none: 0 };
updateScore('linkbuilding', points[val as keyof typeof points] || 0);
}
});
});
page5.addRow(row => {
row.addRadioButton('backlinkQuality', {
label: 'What type of sites link to you?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'high', name: '🏆 High-authority industry sites' },
{ id: 'mixed', name: '📊 Mix of quality and average sites' },
{ id: 'low', name: '📉 Mostly low-quality or directory links' },
{ id: 'unknown', name: '🤷 Not sure / Haven\'t checked' }
],
onValueChange: (val) => {
const points = { high: 5, mixed: 3, low: 1, unknown: 1 };
updateScore('linkquality', points[val as keyof typeof points] || 0);
}
});
});
page5.addRow(row => {
row.addRadioButton('internalLinking', {
label: 'Do you have a strong internal linking structure?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'strategic', name: '🔗 Yes, strategic internal linking between related content' },
{ id: 'basic', name: '📝 Basic navigation and some contextual links' },
{ id: 'minimal', name: '⚠️ Only navigation menus' },
{ id: 'none', name: '❌ No internal linking strategy' }
],
onValueChange: (val) => {
const points = { strategic: 5, basic: 3, minimal: 1, none: 0 };
updateScore('internal', points[val as keyof typeof points] || 0);
}
});
});
page5.addRow(row => {
row.addTextPanel('backlinkScore', {
computedValue: () => {
const s = scores();
const sectionScore = (s['linkbuilding'] || 0) + (s['linkquality'] || 0) + (s['internal'] || 0);
return `🔗 Backlinks & Authority Score: ${sectionScore}/15`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
// ============ PAGE 6: SEO Tools & Tracking ============
const page6 = pages.addPage('seo-tools', { mobileBreakpoint: 500 });
page6.addRow(row => {
row.addTextPanel('header6', {
label: 'Step 6 of 7: SEO Tools & Tracking',
computedValue: () => 'You can\'t improve what you don\'t measure',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page6.addSpacer({ height: '24px' });
page6.addRow(row => {
row.addRadioButton('analytics', {
label: 'Do you use Google Analytics or similar tools?',
isRequired: true,
orientation: 'vertical',
options: [
{ id: 'ga4', name: '📊 Yes, Google Analytics 4 properly configured' },
{ id: 'basic', name: '📈 Basic analytics setup' },
{ id: 'other', name: '🔧 Other analytics tool' },
{ id: 'none', name: '❌ No analytics tracking' }
],
onValueChange: (val) => {
const points = { ga4: 5, basic: 3, other: 4, none: 0 };
updateScore('analytics', points[val as keyof typeof points] || 0);
}
});
});
page6.addRow(row => {
row.addRadioButton('searchConsole', {
label: 'Is your site registered with Google Search Console?',
isRequired: true,
orientation: 'vertical',
tooltip: 'Google Search Console is a free tool that shows how Google sees your site, what keywords you rank for, and any indexing issues.',
options: [
{ id: 'active', name: '✅ Yes, actively monitored' },
{ id: 'setup', name: '📋 Setup but rarely checked' },
{ id: 'no', name: '❌ No' },
{ id: 'unknown', name: '🤷 What\'s that?' }
],
onValueChange: (val) => {
const points = { active: 5, setup: 3, no: 0, unknown: 0 };
updateScore('searchconsole', points[val as keyof typeof points] || 0);
}
});
});
page6.addRow(row => {
row.addRadioButton('sitemap', {
label: 'Do you have an XML sitemap submitted to search engines?',
isRequired: true,
orientation: 'vertical',
tooltip: 'A sitemap is a file that lists all pages on your site, helping search engines discover and index your content. Check yoursite.com/sitemap.xml',
options: [
{ id: 'yes', name: '✅ Yes, auto-updated and submitted' },
{ id: 'exists', name: '📄 Sitemap exists but not sure if submitted' },
{ id: 'no', name: '❌ No sitemap' },
{ id: 'unknown', name: '🤷 Not sure' }
],
onValueChange: (val) => {
const points = { yes: 5, exists: 3, no: 0, unknown: 1 };
updateScore('sitemap', points[val as keyof typeof points] || 0);
}
});
});
page6.addRow(row => {
row.addTextPanel('toolsScore', {
computedValue: () => {
const s = scores();
const sectionScore = (s['analytics'] || 0) + (s['searchconsole'] || 0) + (s['sitemap'] || 0);
return `🛠️ Tools & Tracking Score: ${sectionScore}/15`;
},
customStyles: {
fontSize: '1rem',
fontWeight: '600',
color: '#1e40af',
textAlign: 'center',
padding: '12px',
background: '#dbeafe',
borderRadius: '8px',
marginTop: '1rem'
}
});
});
page6.addSpacer({ height: '20px' });
// ============ FINAL SCORE SUMMARY ============
page6.addRow(row => {
row.addTextPanel('finalScoreLabel', {
label: '📊 Your SEO Health Check Results',
computedValue: () => '',
customStyles: {
fontSize: '1.2rem',
fontWeight: '700',
textAlign: 'center',
marginTop: '1rem'
}
});
});
page6.addRow(row => {
row.addTextPanel('finalGrade', {
computedValue: () => getGradeLabel(),
customStyles: {
fontSize: '1.5rem',
fontWeight: '800',
textAlign: 'center',
color: getGradeColor(),
padding: '15px',
background: '#f9fafb',
borderRadius: '12px',
border: `3px solid ${getGradeColor()}`
}
});
});
page6.addRow(row => {
row.addTextPanel('scoreBreakdown', {
computedValue: () => {
const total = getTotalScore();
const pct = getScorePercentage();
return `Total Score: ${total}/${getMaxScore()} (${pct}%)`;
},
customStyles: {
fontSize: '1.1rem',
fontWeight: '600',
textAlign: 'center',
color: '#374151',
marginTop: '10px'
}
});
});
page6.addRow(row => {
row.addTextPanel('recommendation', {
computedValue: () => {
const grade = getGrade();
const recommendations = {
A: '🏆 Outstanding SEO! Your website is well-positioned to dominate search results. Download your report for advanced optimization tips.',
B: '✅ Solid foundation! A few improvements could significantly boost your rankings. Get your personalized action plan.',
C: '⚡ Room for improvement! Several areas need attention. Your report contains prioritized recommendations.',
D: '⚠️ Significant issues detected! Your website is losing valuable organic traffic. Download your urgent action plan.',
F: '🚨 Critical problems! Your site may be nearly invisible to search engines. Immediate action is required.'
};
return recommendations[grade];
},
customStyles: {
fontSize: '0.95rem',
color: '#4b5563',
textAlign: 'center',
padding: '15px',
background: '#f3f4f6',
borderRadius: '8px',
marginTop: '15px',
lineHeight: '1.5'
}
});
});
// ============ PAGE 7: Lead Capture ============
const page7 = pages.addPage('lead-capture', { mobileBreakpoint: 500 });
page7.addRow(row => {
row.addTextPanel('header7', {
label: 'Step 7 of 7: Get Your Report',
computedValue: () => 'Enter your details to receive your personalized SEO report',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280',
marginBottom: '1rem'
}
});
});
page7.addSpacer({ height: '24px' });
page7.addRow(row => {
row.addTextPanel('leadCapture', {
label: '📧 Get Your Detailed SEO Report',
computedValue: () => 'Enter your details to receive a comprehensive PDF report with personalized recommendations',
customStyles: {
fontSize: '0.9rem',
color: '#6b7280'
}
});
});
page7.addRow(row => {
row.addTextbox('name', {
label: 'Your Name',
isRequired: true,
placeholder: 'John Smith'
}, '1fr');
row.addEmail('email', {
label: 'Work Email',
isRequired: true,
placeholder: 'john@company.com'
}, '1fr');
});
page7.addRow(row => {
row.addTextbox('company', {
label: 'Company Name',
placeholder: 'Acme Inc.'
}, '1fr');
row.addTextbox('phone', {
label: 'Phone (optional)',
placeholder: '+1 (555) 123-4567'
}, '1fr');
});
page7.addRow(row => {
row.addCheckboxList('consent', {
options: [
{
id: 'report',
name: '📄 Send me the detailed PDF SEO report',
isRequired: true
},
{
id: 'tips',
name: '💡 Send me weekly SEO tips and updates'
},
{
id: 'audit',
name: '🔍 I\'d like a free website SEO audit consultation'
}
],
defaultValue: ['report'],
orientation: 'vertical'
});
});
// ============ PDF REPORT ============
form.configurePdf('seo-report', pdf => {
pdf.configure({
filename: 'seo-health-check-report.pdf',
pageSize: 'A4',
allowUserDownload: true,
downloadButtonLabel: '📄 Download SEO Report',
header: {
title: 'SEO Health Check Report',
subtitle: 'Comprehensive Website Analysis'
},
footer: {
text: 'Generated by FormTs SEO Health Check Tool',
showPageNumbers: true
}
});
pdf.addSection('Executive Summary', section => {
section.addRow(row => {
row.addField('Overall Grade', getGradeLabel());
row.addField('SEO Score', `${getScorePercentage()}%`);
});
section.addRow(row => {
row.addField('Assessment Date', new Date().toLocaleDateString());
row.addField('Total Points', `${getTotalScore()} / ${getMaxScore()}`);
});
section.addRow(row => {
row.addField('Website', page1.textbox('websiteUrl')?.value() || 'N/A');
row.addField('Website Type', page1.dropdown('websiteType')?.value() || 'N/A');
});
});
pdf.addSection('Category Breakdown', section => {
const s = scores();
const technicalScore = (s['https'] || 0) + (s['mobile'] || 0) + (s['speed'] || 0);
const onpageScore = (s['titles'] || 0) + (s['meta'] || 0) + (s['headings'] || 0) + (s['images'] || 0);
const contentScore = (s['freshness'] || 0) + (s['keywords'] || 0) + (s['length'] || 0) + (s['unique'] || 0);
const backlinkScore = (s['linkbuilding'] || 0) + (s['linkquality'] || 0) + (s['internal'] || 0);
const toolsScore = (s['analytics'] || 0) + (s['searchconsole'] || 0) + (s['sitemap'] || 0);
section.addTable(
['SEO Category', 'Score', 'Max', 'Status'],
[
['Technical SEO', `${technicalScore}`, '30', technicalScore >= 22 ? '✅ Good' : '⚠️ Needs Work'],
['On-Page SEO', `${onpageScore}`, '20', onpageScore >= 15 ? '✅ Good' : '⚠️ Needs Work'],
['Content Quality', `${contentScore}`, '20', contentScore >= 15 ? '✅ Good' : '⚠️ Needs Work'],
['Backlinks & Authority', `${backlinkScore}`, '15', backlinkScore >= 11 ? '✅ Good' : '⚠️ Needs Work'],
['Tools & Tracking', `${toolsScore}`, '15', toolsScore >= 11 ? '✅ Good' : '⚠️ Needs Work'],
]
);
});
pdf.addPageBreak();
pdf.addSection('Detailed Responses', section => {
const websiteUrl = page1.textbox('websiteUrl')?.value();
const websiteType = page1.dropdown('websiteType')?.value();
const websiteAge = page1.dropdown('websiteAge')?.value();
section.addRow(row => {
row.addField('Website URL', websiteUrl || 'Not specified');
row.addField('Website Type', websiteType || 'Not specified');
});
section.addRow(row => {
row.addField('Website Age', websiteAge || 'Not specified');
});
section.addSpacer(10);
const https = page2.radioButton('https')?.value();
const mobile = page2.radioButton('mobileOptimized')?.value();
const speed = page2.radioButton('pageSpeed')?.value();
section.addRow(row => {
row.addField('HTTPS', https === 'yes' ? 'Yes ✅' : https === 'partial' ? 'Partial ⚠️' : 'No ❌');
row.addField('Mobile-Friendly', mobile === 'responsive' ? 'Yes ✅' : mobile === 'partially' ? 'Partial ⚠️' : 'No ❌');
});
section.addRow(row => {
row.addField('Page Speed', speed === 'fast' ? 'Fast ✅' : speed === 'average' ? 'Average ⚠️' : 'Slow ❌');
});
});
pdf.addSection('Priority Recommendations', section => {
const grade = getGrade();
if (grade === 'F' || grade === 'D') {
section.addText('🚨 URGENT ACTIONS REQUIRED:');
section.addText('1. Ensure your website uses HTTPS (secure connection)');
section.addText('2. Make your website mobile-friendly immediately');
section.addText('3. Set up Google Analytics and Search Console');
section.addText('4. Create and submit an XML sitemap');
section.addText('5. Optimize page load speed (aim for under 3 seconds)');
} else if (grade === 'C') {
section.addText('⚡ RECOMMENDED IMPROVEMENTS:');
section.addText('1. Optimize title tags and meta descriptions for all pages');
section.addText('2. Start a regular content publishing schedule');
section.addText('3. Implement strategic internal linking');
section.addText('4. Begin a backlink outreach strategy');
} else if (grade === 'B') {
section.addText('✅ OPTIMIZATION OPPORTUNITIES:');
section.addText('1. Focus on building high-quality backlinks');
section.addText('2. Expand content depth and keyword coverage');
section.addText('3. Improve page speed to under 2 seconds');
section.addText('4. Consider advanced schema markup');
} else {
section.addText('🏆 ADVANCED RECOMMENDATIONS:');
section.addText('1. Explore featured snippet opportunities');
section.addText('2. Implement advanced technical SEO (Core Web Vitals)');
section.addText('3. Build topical authority in your niche');
section.addText('4. Consider international SEO if applicable');
}
});
});
// ============ SUBMIT BUTTON ============
form.configureSubmitButton({
label: () => `🔍 Get My SEO Report (Grade: ${getGrade()})`
});
form.configureSubmitBehavior({
sendToServer: true
});
}