DEV Community

Eioki
Eioki

Posted on Edited on

Free n8n Workflow: Scrape Google Maps & Detect Missing GA4/Booking Systems (JSON Included)

If you have ever built a local B2B lead-generation workflow in n8n, Make, or Python, you probably know the exact pain of "scraper chaining":

  1. Run a Google Maps scraper to get business names and websites.
  2. Pipe those URLs into a second tool to extract emails and social links.
  3. Run a third check to see if the business actually needs your service (e.g., missing GA4, no Meta Pixel, no online booking widget).
  4. Send everything to an LLM to write a non-generic cold email opener.
  5. Realize you paid three times for duplicate franchise locations across neighboring zip codes.

To eliminate that friction, I designed a single-pass, API-first pipeline—packaged as an Apify Actor (Local Business Lead & Tech-Gap Analyzer)—that handles extraction, deduplication, tech-stack auditing, and structured AI scoring in one step.

1. Official Data First (No Brittle Headless Browsers)

Instead of spinning up heavy Playwright/Puppeteer instances that break every time a DOM class changes, Step 1 queries the Google Places API (New) (places:searchText) using strict X-Goog-FieldMask headers so only required fields are fetched.

Before doing any downstream processing or billing, records pass through a two-key deduplication gate (placeId + normalized root domain). If "Austin, TX" and "Round Rock, TX" return the same clinic, the duplicate is dropped immediately.

2. Fast, Async Website Tech-Gap Scanning (httpx + BeautifulSoup)

Using httpx.AsyncClient with a strict 6-second timeout and 350 KB HTML cap, a lightweight scanner inspects each business homepage for concrete conversion and analytics signals:

  • Analytics & Ad Pixels: Checks for gtag( / G- (GA4), googletagmanager.com/gtm.js (GTM), and fbq( (Meta Pixel).
  • Online Booking Friction: Detects Calendly, Acuity, Square Appointments, Mindbody, OpenTable, Resy, Zocdoc, and direct /book CTAs.
  • Contact & Social Surface: Extracts clean public email addresses and social profiles.

3. Structured Bottleneck Scoring with Gemini Flash

The combined business profile, recent reviews, and website tech-scan JSON are passed to Gemini Flash using Pydantic-enforced response_schema JSON output to generate a 1–5 bottleneck score, concrete weaknesses, and a tailored 2-sentence cold outreach hook.

Try It Out

👉 Local Business Lead & Tech-Gap Analyzer on Apify Store

Free Copy-Paste n8n Workflow JSON

Want to automate this every Monday morning? Copy the JSON below and paste it directly into your n8n canvas (Ctrl + V / Cmd + V).

Quick Setup (1 Minute):

  1. Paste this JSON into n8n.
  2. Open the Run Local Lead & Tech-Gap Analyzer (Apify) node.
  3. Under Authentication, select Header Auth, set Name to Authorization, and Value to Bearer YOUR_APIFY_API_TOKEN.

json
{
  "name": "Google Maps Local B2B Lead & Tech-Gap Scraper (Apify + Gemini)",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "909e309d-9623-4e00-b672-997cff4d421e",
      "name": "Weekly Monday Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        220,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "[https://api.apify.com/v2/acts/cautious_canteen_a8q~local-business-lead-techgap-analyzer/run-sync-get-dataset-items](https://api.apify.com/v2/acts/cautious_canteen_a8q~local-business-lead-techgap-analyzer/run-sync-get-dataset-items)",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"searchQueries\": [\n    \"Dentist\",\n    \"Med Spa\"\n  ],\n  \"locations\": [\n    \"Austin, TX\"\n  ],\n  \"maxResultsPerQuery\": 15,\n  \"includeReviews\": true,\n  \"scanWebsite\": true\n}",
        "options": {
          "timeout": 120000
        }
      },
      "id": "d8272d31-e46b-4ae2-9628-75b5e770c9b9",
      "name": "Run Local Lead & Tech-Gap Analyzer (Apify)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "206cb8ce-e4ee-4c35-8a50-37720c6c9c03",
              "leftValue": "={{ $json.bottleneckScore }}",
              "rightValue": 4,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "1c2a8aac-2163-44ca-ae09-39a0f62dc4e5",
      "name": "Filter High Tech-Gap Leads (Score >= 4)",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        740,
        300
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "82639b4b-12cb-4a0c-8b60-5f67d8e9ef7a",
              "name": "businessName",
              "value": "={{ $json.name }}",
              "type": "string"
            },
            {
              "id": "ad81264c-f0ea-454b-84bd-7ba2bd6cfdc8",
              "name": "website",
              "value": "={{ $json.website }}",
              "type": "string"
            },
            {
              "id": "85aa9987-0348-4ddb-8692-310b8d9c0962",
              "name": "emails",
              "value": "={{ $json.extractedEmails }}",
              "type": "array"
            },
            {
              "id": "91c5ab63-4434-47aa-b0d8-fc76cb2afe36",
              "name": "pitchCategory",
              "value": "={{ $json.bestAgencyPitchCategory }}",
              "type": "string"
            },
            {
              "id": "96c2fa1c-02c9-49a2-84b5-8e75432c5252",
              "name": "coldOutreachHook",
              "value": "={{ $json.coldOutreachHook }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "eee4f456-aa61-4dad-8c1f-c625c32b8aa2",
      "name": "Format CRM / Cold Email Payload",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1000,
        280
      ]
    }
  ],
  "connections": {
    "Weekly Monday Trigger": {
      "main": [
        [
          {
            "node": "Run Local Lead & Tech-Gap Analyzer (Apify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Local Lead & Tech-Gap Analyzer (Apify)": {
      "main": [
        [
          {
            "node": "Filter High Tech-Gap Leads (Score >= 4)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter High Tech-Gap Leads (Score >= 4)": {
      "main": [
        [
          {
            "node": "Format CRM / Cold Email Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)