{
  "id": "oJexK5ZyuvEGNMQw",
  "meta": {
    "builderVariant": "mcp",
    "aiBuilderAssisted": true
  },
  "name": "Analyze landing page with OpenAI and get optimization tips to convert",
  "tags": [],
  "nodes": [
    {
      "id": "332075ec-e9ad-413e-93d8-3cb3354fb27e",
      "name": "Submit landing page URL",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -496,
        32
      ],
      "parameters": {
        "options": {},
        "formTitle": "Landing Page Optimizer",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Landing Page URL",
              "placeholder": "https://example.com",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Paste your landing page URL and get an instant AI-powered CRO audit with conversion tips."
      },
      "typeVersion": 2.6
    },
    {
      "id": "d969600c-d2ad-4710-ab27-e3a3d6e79cbe",
      "name": "Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        32
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-url",
              "name": "landing_page_url",
              "type": "string",
              "value": "={{ $json['Landing Page URL'] }}"
            },
            {
              "id": "cfg-model",
              "name": "ai_model",
              "type": "string",
              "value": "gpt-5.4"
            },
            {
              "id": "cfg-fixer",
              "name": "fixer_model",
              "type": "string",
              "value": "gpt-5.4-mini"
            },
            {
              "id": "cfg-tips",
              "name": "number_of_tips",
              "type": "number",
              "value": 10
            },
            {
              "id": "cfg-lang",
              "name": "output_language",
              "type": "string",
              "value": "English"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5244903e-f09c-4577-a710-bc6897f87820",
      "name": "Scrape landing page HTML",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "maxTries": 3,
      "position": [
        80,
        32
      ],
      "parameters": {
        "url": "={{ $('Configuration').item.json.landing_page_url }}",
        "options": {
          "timeout": 30000,
          "redirect": {
            "redirect": {}
          },
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.4,
      "waitBetweenTries": 5000
    },
    {
      "id": "0d95bc1f-9975-4c2e-8cfa-bb105db894c7",
      "name": "OpenAI model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        304,
        304
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Configuration').item.json.ai_model }}"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "d6662cca-89a2-4be3-83f2-004e2db200ae",
      "name": "Sticky Note 579d65a7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -432
      ],
      "parameters": {
        "width": 540,
        "height": 1976,
        "content": "# Analyze landing page with OpenAI and get optimization tips to convert\n# \ud83d\udce5  [Open full documentation on Notion](https://automatisation.notion.site/Course-Analyze-landing-page-with-OpenAI-and-get-optimization-tips-to-convert-39a3d6550fd98176a28fc776afad7fae)\n\nPaste a landing page URL and get an instant, expert-level CRO audit: an overall conversion score out of 100, a score for each key area (headline, CTA, social proof, visual hierarchy, copy, mobile), a friendly roast, and a ranked list of specific, personalized fixes with before/after examples \u2014 all shown as a clean report right in your browser.\n\n## Who is it for\n- SaaS founders & startups who want every visitor to count\n- Marketers & growth teams turning pages into high-converting assets\n- E-commerce & lead-gen businesses where more conversions means more revenue\n\n## How it works\n1. Submit your landing page URL in the built-in form.\n2. The workflow scrapes the page HTML (with automatic retries).\n3. An OpenAI model scores the page, roasts it, and returns structured, personalized tips (validated by a Structured Output Parser with an auto-fix model).\n4. A styled report page is built and shown to you in the browser, and every audit is logged to a built-in n8n Data Table.\n5. If the page cannot be fetched, a friendly error page is shown instead.\n\n## Setup\n1. Add your OpenAI credential (API key) and select it on both AI model nodes (\"OpenAI model\" and \"Output fixer model\").\n2. Select your Data Table on \"Log audit to Data Table\" \u2014 a table named \"CRO Audit Log\" with columns url, cro_score, verdict, summary, language, analyzed_at.\n3. Open the \"Configuration\" node and adjust the defaults if needed (model, fixer model, number of tips, output language).\n4. Click \"Test workflow\", submit a URL, and read the report in your browser.\n\n## Requirements\n- An OpenAI account with an API key (used by both AI model nodes).\n- A built-in n8n Data Table for the audit log (no external account needed).\n\n## Customization\n- Change the AI model, fixer model, number of tips, or output language in one place: the \"Configuration\" node.\n- Edit the audit rules and scoring in the \"Analyze landing page (CRO)\" node (system message + prompt) and the JSON schema in \"Structured Output Parser\".\n- Restyle the browser report in the \"Build CRO report\" node (HTML/CSS).\n- Swap the form trigger for a Webhook or Schedule trigger to run audits automatically.\n\nNeed help customizing?\nContact me for consulting and support : [Linkedin](https://www.linkedin.com/in/doctor-firass/)\n\n# MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new YouTube channel](https://www.youtube.com/@DrFiras_AI). Here I will share videos and Shorts with practical tutorials and FREE templates for n8n.\n\n[![The AI Doctor](https://www.dr-firas.com/the-ai-doctor.png)](https://www.youtube.com/@DrFiras_AI)"
      },
      "typeVersion": 1
    },
    {
      "id": "abcc5922-ccab-483b-b325-7a2410679c3e",
      "name": "Sticky Note a20679c2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 544,
        "content": "### 1. Collect URL & configure\nThe form collects the landing page URL, then the Configuration node centralizes every adjustable setting (AI model, fixer model, number of tips, output language) so a beginner configures everything in one place."
      },
      "typeVersion": 1
    },
    {
      "id": "f4341aff-d877-480c-aee7-f4f9827f238a",
      "name": "Sticky Note 297eaea9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 544,
        "content": "### 2. Scrape the page\nAn HTTP Request downloads the page HTML (with automatic retries) so the AI analyzes the real content. If the page blocks bots or is offline, the error output shows a friendly page instead."
      },
      "typeVersion": 1
    },
    {
      "id": "ed551468-910f-409c-88c8-d05e078a8bf8",
      "name": "Sticky Note 96055679",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 544,
        "content": "### 3. AI CRO audit (structured)\nThe Basic LLM Chain (OpenAI) scores the page out of 100, scores each category, roasts it, and returns personalized tips. The Structured Output Parser (with an auto-fix model) guarantees clean, reliable JSON."
      },
      "typeVersion": 1
    },
    {
      "id": "a376b543-636f-4eb3-972c-9f1b42413590",
      "name": "Analyze landing page (CRO)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        352,
        32
      ],
      "parameters": {
        "text": "=Audit the landing page below and write everything in {{ $('Configuration').item.json.output_language }}.\n\nProduce:\n- cro_score: an honest 0-100 conversion score for this page.\n- verdict: one punchy sentence summarizing the page's single biggest conversion problem or strength.\n- roast: a detailed, friendly, casual roast (human-to-human tone), a few short paragraphs.\n- categories: score each of these six 0-10 with a specific comment \u2014 Headline & Value Proposition, Call To Action, Social Proof & Trust, Visual Hierarchy & Design, Copywriting & Clarity, Mobile & Performance.\n- tips: the TOP {{ $('Configuration').item.json.number_of_tips }} conversion optimization tips, each with priority (High/Medium/Low), a short title, the problem, the fix, and a concrete example (an actual rewritten headline or button label for THIS page). Order tips from highest to lowest impact.\n\nLanding page URL: {{ $('Configuration').item.json.landing_page_url }}\n\nHTML source of the landing page:\n{{ $json.data }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are a world-class Conversion Rate Optimization (CRO) expert auditing landing pages for founders, marketers and growth teams. You are sharp, specific and a little funny. Never give generic advice that could apply to any page \u2014 every observation and tip must reference concrete elements from THIS page's HTML (headline text, button labels, sections, copy, structure). Base every judgement only on the provided HTML. Return raw JSON only that matches the schema. DO NOT wrap it in markdown code blocks and DO NOT add any prose before or after the JSON. Use an empty string for anything you genuinely cannot assess, never omit a field."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "fcd5fdde-ba81-4916-9e90-303653b0eec8",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        512,
        304
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"cro_score\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 100 },\n    \"verdict\": { \"type\": \"string\" },\n    \"roast\": { \"type\": \"string\" },\n    \"categories\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"name\": { \"type\": \"string\", \"enum\": [\"Headline & Value Proposition\", \"Call To Action\", \"Social Proof & Trust\", \"Visual Hierarchy & Design\", \"Copywriting & Clarity\", \"Mobile & Performance\"] },\n          \"score\": { \"type\": \"integer\", \"minimum\": 0, \"maximum\": 10 },\n          \"comment\": { \"type\": \"string\" }\n        },\n        \"required\": [\"name\", \"score\", \"comment\"]\n      }\n    },\n    \"tips\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"priority\": { \"type\": \"string\", \"enum\": [\"High\", \"Medium\", \"Low\"] },\n          \"title\": { \"type\": \"string\" },\n          \"problem\": { \"type\": \"string\" },\n          \"fix\": { \"type\": \"string\" },\n          \"example\": { \"type\": \"string\" }\n        },\n        \"required\": [\"priority\", \"title\", \"problem\", \"fix\", \"example\"]\n      }\n    }\n  },\n  \"required\": [\"cro_score\", \"verdict\", \"roast\", \"categories\", \"tips\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "07e422b7-8c6b-4b95-b874-5c97df8ef0bc",
      "name": "Output fixer model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        640,
        480
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Configuration').item.json.fixer_model }}"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "b82c290e-2d60-4c5a-ba8e-4046253ddff3",
      "name": "Build CRO report",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        32
      ],
      "parameters": {
        "jsCode": "const item = $input.first().json;\nconst data = item.output ?? item;\nconst cfg = $('Configuration').first().json;\nconst url = cfg.landing_page_url || '';\nconst lang = cfg.output_language || 'English';\nconst score = Number(data.cro_score ?? 0);\nconst verdict = data.verdict || '';\nconst roast = data.roast || '';\nconst categories = Array.isArray(data.categories) ? data.categories : [];\nconst tips = Array.isArray(data.tips) ? data.tips : [];\nfunction esc(s){return String(s==null?'':s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}\nconst scoreColor = score >= 75 ? '#16a34a' : score >= 50 ? '#f59e0b' : '#dc2626';\nconst catRows = categories.map(function(c){var cs=Number(c.score||0);var bar=cs>=7?'#16a34a':cs>=4?'#f59e0b':'#dc2626';return '<div style=\"margin:10px 0;\"><div style=\"display:flex;justify-content:space-between;font-weight:600;\"><span>'+esc(c.name)+'</span><span>'+cs+'/10</span></div><div style=\"background:#e5e7eb;border-radius:6px;height:8px;margin-top:4px;\"><div style=\"width:'+(cs*10)+'%;background:'+bar+';height:8px;border-radius:6px;\"></div></div><div style=\"color:#4b5563;font-size:14px;margin-top:4px;\">'+esc(c.comment)+'</div></div>';}).join('');\nconst prio = {High:'#dc2626',Medium:'#f59e0b',Low:'#16a34a'};\nconst tipCards = tips.map(function(t,i){var pc=prio[t.priority]||'#6b7280';return '<div style=\"border:1px solid #e5e7eb;border-left:4px solid '+pc+';border-radius:10px;padding:16px;margin:12px 0;background:#fff;\"><div style=\"display:flex;align-items:center;gap:8px;\"><span style=\"background:'+pc+';color:#fff;font-size:12px;font-weight:700;padding:2px 8px;border-radius:999px;\">'+esc(t.priority)+'</span><span style=\"font-weight:700;font-size:16px;\">'+(i+1)+'. '+esc(t.title)+'</span></div><p style=\"margin:10px 0 4px;\"><strong>Problem:</strong> '+esc(t.problem)+'</p><p style=\"margin:4px 0;\"><strong>Fix:</strong> '+esc(t.fix)+'</p><p style=\"margin:4px 0;background:#f9fafb;padding:8px;border-radius:6px;\"><strong>Example:</strong> '+esc(t.example)+'</p></div>';}).join('');\nconst html = '<div style=\"max-width:760px;margin:0 auto;font-family:-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111827;\"><div style=\"text-align:center;margin-bottom:8px;\"><div style=\"font-size:14px;color:#6b7280;\">CRO audit for</div><div style=\"font-size:16px;font-weight:600;word-break:break-all;\">'+esc(url)+'</div></div><div style=\"text-align:center;margin:16px 0;\"><div style=\"display:inline-block;width:120px;height:120px;border-radius:50%;border:8px solid '+scoreColor+';line-height:104px;font-size:38px;font-weight:800;color:'+scoreColor+';\">'+score+'</div><div style=\"font-size:13px;color:#6b7280;margin-top:4px;\">CRO score / 100</div><p style=\"font-size:17px;font-weight:600;margin:12px auto;max-width:600px;\">'+esc(verdict)+'</p></div><h2 style=\"font-size:18px;border-bottom:2px solid #111827;padding-bottom:6px;\">The roast</h2><p style=\"white-space:pre-wrap;line-height:1.6;color:#374151;\">'+esc(roast)+'</p><h2 style=\"font-size:18px;border-bottom:2px solid #111827;padding-bottom:6px;margin-top:24px;\">Category scores</h2>'+catRows+'<h2 style=\"font-size:18px;border-bottom:2px solid #111827;padding-bottom:6px;margin-top:24px;\">Optimization tips</h2>'+tipCards+'<p style=\"text-align:center;color:#9ca3af;font-size:12px;margin-top:24px;\">Generated with n8n + OpenAI</p></div>';\nconst summary = tips.slice(0,3).map(function(t,i){return (i+1)+'. '+t.title;}).join(' | ');\nreturn [{ json: { report_html: html, cro_score: score, verdict: verdict, summary: summary, url: url, language: lang, analyzed_at: new Date().toISOString() } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "15769f8a-c17e-4913-b638-5e5550280b64",
      "name": "Log audit to Data Table",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        912,
        32
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $('Build CRO report').item.json.url }}",
            "summary": "={{ $('Build CRO report').item.json.summary }}",
            "verdict": "={{ $('Build CRO report').item.json.verdict }}",
            "language": "={{ $('Build CRO report').item.json.language }}",
            "cro_score": "={{ $('Build CRO report').item.json.cro_score }}",
            "analyzed_at": "={{ $('Build CRO report').item.json.analyzed_at }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cro_score",
              "type": "number",
              "display": true,
              "required": false,
              "displayName": "cro_score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "verdict",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "verdict",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "language",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "language",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "analyzed_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "analyzed_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow"
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "BNiGCyv1aJG6C9Ij",
          "cachedResultName": "CRO Audit Log"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "eb942dd9-6235-4b4f-acd2-0a938b26761b",
      "name": "Show CRO report",
      "type": "n8n-nodes-base.form",
      "position": [
        1168,
        32
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "={{ $('Build CRO report').item.json.report_html }}"
      },
      "typeVersion": 2.5
    },
    {
      "id": "3425e588-c8f1-4391-8e2c-ab2f6f62ab93",
      "name": "Show error page",
      "type": "n8n-nodes-base.form",
      "position": [
        80,
        240
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "=<div style=\"max-width:640px;margin:40px auto;font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;text-align:center;color:#111827;\"><div style=\"font-size:48px;\">\ud83d\ude15</div><h2>We couldn't analyze that page</h2><p style=\"color:#4b5563;\">The URL <strong>{{ $('Configuration').item.json.landing_page_url }}</strong> could not be fetched (it may block bots, be offline, or require a login). Please check the URL and try again.</p></div>"
      },
      "typeVersion": 2.5
    },
    {
      "id": "b7537e42-d570-49cf-afbf-d7395a78be36",
      "name": "Sticky Note report stage",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 740,
        "height": 544,
        "content": "### 4. Build report, log & deliver\nThe Code node builds a styled HTML report from the structured audit. Every audit is logged to the \"CRO Audit Log\" Data Table, and the report is shown to the user directly in the browser."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": true,
    "executionOrder": "v1"
  },
  "versionId": "31b1031c-055d-48df-8bf4-df366328e6fe",
  "nodeGroups": [],
  "connections": {
    "OpenAI model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze landing page (CRO)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Configuration": {
      "main": [
        [
          {
            "node": "Scrape landing page HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build CRO report": {
      "main": [
        [
          {
            "node": "Log audit to Data Table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output fixer model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Log audit to Data Table": {
      "main": [
        [
          {
            "node": "Show CRO report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit landing page URL": {
      "main": [
        [
          {
            "node": "Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape landing page HTML": {
      "main": [
        [
          {
            "node": "Analyze landing page (CRO)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Show error page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze landing page (CRO)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Analyze landing page (CRO)": {
      "main": [
        [
          {
            "node": "Build CRO report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}