diff --git a/components/GoogleAdsGenerator.tsx b/components/GoogleAdsGenerator.tsx
index 88f2c24..d33d7b2 100644
--- a/components/GoogleAdsGenerator.tsx
+++ b/components/GoogleAdsGenerator.tsx
@@ -391,7 +391,140 @@ export default function GoogleAdsGenerator() {
};
const exportHTML = () => {
- alert("Please use 'Export CSV' for the full detailed report. HTML export is currently being upgraded.");
+ if (!googleAdsResult && !magicWandResult) return;
+
+ alert("Please use 'Export CSV' for the full detailed report. HTML export is disabled."); return; /*
+ parts.push(`
`);
+
+ parts.push(`
Google Ads Strategy Report
Generated by PromptArch on ${new Date().toLocaleDateString()}
`);
+
+ if (googleAdsResult) {
+ // Keywords
+ parts.push(`
🎯 Keyword Research
`);
+ if (googleAdsResult.keywords) {
+ if (Array.isArray(googleAdsResult.keywords.primary)) {
+ parts.push(`
Primary Keywords
`);
+ for (const k of googleAdsResult.keywords.primary) {
+ parts.push(`${k.keyword} (${k.cpc || 'N/A'})`);
+ }
+ parts.push(`
`);
+ }
+ if (Array.isArray(googleAdsResult.keywords.longTail)) {
+ parts.push(`
Long-tail Opportunities
`);
+ for (const k of googleAdsResult.keywords.longTail) {
+ parts.push(`${k.keyword} (${k.cpc || 'N/A'})`);
+ }
+ parts.push(`
`);
+ }
+ if (Array.isArray(googleAdsResult.keywords.negative)) {
+ parts.push(`
Negative Keywords
`);
+ for (const k of googleAdsResult.keywords.negative) {
+ parts.push(`${k.keyword} (${k.cpc || 'N/A'})`);
+ }
+ parts.push(`
`);
+ }
+ }
+ parts.push(`
`);
+
+ // Ad Copies
+ if (Array.isArray(googleAdsResult.adCopies)) {
+ parts.push(`
✍️ Ad Copy Variations
`);
+ let i = 0;
+ for (const ad of googleAdsResult.adCopies) {
+ i++;
+ parts.push(`
Variation ${i}
`);
+ if (Array.isArray(ad.headlines)) {
+ for (const h of ad.headlines) {
+ parts.push(`
${h}
`);
+ }
+ }
+ if (Array.isArray(ad.descriptions)) {
+ parts.push(`
${(ad.descriptions || []).join('
')}
`);
+ }
+ if (ad.callToAction) {
+ parts.push(`
${ad.callToAction}
`);
+ }
+ parts.push(`
`);
+ }
+ parts.push(`
`);
+ }
+
+ // Campaigns
+ if (Array.isArray(googleAdsResult.campaigns)) {
+ parts.push(`
🏗️ Campaign Structure
`);
+ for (const c of googleAdsResult.campaigns) {
+ parts.push(`
${c.name}
`);
+ parts.push(`
${c.type.toUpperCase()} • ${c.budget?.daily} ${c.budget?.currency}/day
`);
+ const locs = c.targeting?.locations ? c.targeting.locations.join(', ') : 'Global';
+ parts.push(`
Locations: ${locs}
Ad Groups: ${c.adGroups ? c.adGroups.length : 0}
`);
+ }
+ parts.push(`
`);
+ }
+
+ // Implementation & Predictions
+ parts.push(`
🚀 Implementation & Forecast
`);
+ if (googleAdsResult.implementation && Array.isArray(googleAdsResult.implementation.setupSteps)) {
+ parts.push(`
Setup Steps
`);
+ for (const s of googleAdsResult.implementation.setupSteps) {
+ parts.push(`- ${s}
`);
+ }
+ parts.push(`
`);
+ }
+
+ if (googleAdsResult.predictions) {
+ const p = googleAdsResult.predictions;
+ parts.push(`
Monthly Estimations
`);
+ parts.push(`
${p.estimatedClicks || '-'}
Clicks
`);
+ parts.push(`
${p.estimatedCtr || '-'}
CTR
`);
+ parts.push(`
${p.estimatedConversions || '-'}
Convs
`);
+ parts.push(`
`);
+ }
+ parts.push(`
`);
+ }
+
+ if (magicWandResult) {
+ parts.push(`
🧠 Market Intelligence
`);
+ parts.push(`
Strategy Rationale
${magicWandResult.rationale}
`);
+ const ma = magicWandResult.marketAnalysis;
+ parts.push(`
Market Data
Growth Rate: ${ma?.growthRate || 'N/A'}
Top Competitors
`);
+ if (ma && Array.isArray(ma.topCompetitors)) {
+ for (const c of ma.topCompetitors) {
+ parts.push(`- ${c}
`);
+ }
+ } else {
+ parts.push(`- None identified
`);
+ }
+ parts.push(`
`);
+ }
+
+ parts.push(`
`);
+
+ const blob = new Blob([parts.join('')], { type: 'text/html' });
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.setAttribute("href", url);
+ link.setAttribute("download", `google-ads-report-${new Date().toISOString().split('T')[0]}.html`);
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ */
};
const sections = [
diff --git a/lib/services/qwen-oauth.ts b/lib/services/qwen-oauth.ts
index 2c09703..f8acea6 100644
--- a/lib/services/qwen-oauth.ts
+++ b/lib/services/qwen-oauth.ts
@@ -790,6 +790,11 @@ Generate SPECTACULAR slides with CSS3 animations, SVG charts, modern gradients,
const systemMessage: ChatMessage = {
role: "system",
content: `You are an EXPERT Google Ads strategist. Create HIGH-CONVERTING campaigns with comprehensive keyword research, compelling ad copy, and optimized campaign structures.
+
+CRITICAL ACCURACY PROTOCOL:
+1. STRICT ADHERENCE TO FACTS: Use ONLY locations, contact info, and services explicitly mentioned in the provided Website URL or Products list.
+2. DO NOT HALLUCINATE LOCATIONS: If no specific location is provided, default to "National" or "Global" based on the URL TLD (e.g. .co.uk -> UK). DO NOT invent cities or streets.
+3. COMPREHENSIVE OUTPUT: You MUST generate full lists (15+ keywords, 3+ ad variations). Do not truncate.
OUTPUT FORMAT - Return ONLY valid JSON with this structure:
\`\`\`json
@@ -834,7 +839,9 @@ Requirements:
- 10-15 primary keywords, 15-20 long-tail, 5-10 negative
- Headlines max 30 chars, descriptions max 90 chars
- 3-5 ad variations per campaign
-- Include budget and targeting recommendations`,
+- 3-5 ad variations per campaign
+- Include budget and targeting recommendations
+- ENSURE ALL LISTS ARE POPULATED. No empty arrays.`,
};
const userMessage: ChatMessage = {
@@ -851,7 +858,8 @@ ${campaignDuration ? `DURATION: ${campaignDuration}` : ""}
${competitors.length > 0 ? `COMPETITORS: ${competitors.join(", ")}` : ""}
${specialInstructions ? `SPECIAL INSTRUCTIONS: ${specialInstructions}` : ""}
-Generate complete Google Ads package with keywords, ad copy, campaigns, and implementation guidance.`,
+Generate complete Google Ads package with keywords, ad copy, campaigns, and implementation guidance.
+STRICTLY FOLLOW LOCALIZATION: Use only locations relevant to the provided website. Do not invent office locations.`,
};
return this.chatCompletion([systemMessage, userMessage], model || "coder-model");