{
  "name": "Monitor competitor rankings with Local Falcon",
  "nodes": [
    {
      "parameters": {
        "content": "## Monitor Competitor Rankings with Local Falcon\n\n**Who is this for:** SEO professionals who want to track competitor visibility alongside their own rankings to identify opportunities and threats.\n\n**What this workflow does:**\n1. Runs scans for your location AND competitor locations\n2. Compares average rankings across the same keywords\n3. Calculates competitive position changes\n4. Sends alerts when competitors outrank you\n5. Logs comparison data to Google Sheets\n\n**How to set up:**\n1. Add your Local Falcon API credentials (get your key at https://www.localfalcon.com/api/credentials)\n2. Configure your location and competitor place IDs in Settings\n3. Set up the keywords you want to track\n4. Connect Google Sheets for data logging\n5. Connect Slack for competitive alerts\n6. Activate the workflow\n\n**Requirements:**\n- Local Falcon account with API access and credits\n- Competitor Google Place IDs (find via Local Falcon search)\n- Google Sheets for tracking history\n\n**How to customize:**\n- Add more competitors to track\n- Create separate alerts for different threat levels\n- Build competitive dashboards in Looker Studio",
        "height": 560,
        "width": 460,
        "color": 5
      },
      "id": "sticky-main",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        100,
        -220
      ]
    },
    {
      "parameters": {
        "content": "### Step 1: Schedule\nRuns weekly for competitor analysis.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        40,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 2: Settings\nConfigure locations and keywords.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        300,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 3: Run Scans\nScans you and competitors.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 4: Compare\nAnalyzes competitive position.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step4",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        820,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Step 5: Alert\nNotifies on competitive changes.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1080,
        680
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 6
            }
          ]
        }
      },
      "id": "schedule",
      "name": "Every Monday 6am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        140,
        460
      ]
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "{\n  \"yourLocation\": {\n    \"name\": \"Your Business\",\n    \"place_id\": \"YOUR_PLACE_ID\",\n    \"lat\": \"40.7128\",\n    \"lng\": \"-74.0060\"\n  },\n  \"competitors\": [\n    {\n      \"name\": \"Competitor 1\",\n      \"place_id\": \"COMPETITOR_1_PLACE_ID\"\n    },\n    {\n      \"name\": \"Competitor 2\",\n      \"place_id\": \"COMPETITOR_2_PLACE_ID\"\n    }\n  ],\n  \"keywords\": [\"your main keyword\", \"secondary keyword\"],\n  \"slackChannel\": \"#competitive-intel\"\n}",
        "options": {}
      },
      "id": "settings",
      "name": "Competitive Settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        400,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const settings = $input.first().json;\nconst scans = [];\n\n// Add your location\nfor (const keyword of settings.keywords) {\n  scans.push({\n    json: {\n      name: settings.yourLocation.name,\n      place_id: settings.yourLocation.place_id,\n      keyword: keyword,\n      lat: settings.yourLocation.lat,\n      lng: settings.yourLocation.lng,\n      isYou: true\n    }\n  });\n}\n\n// Add competitors\nfor (const competitor of settings.competitors) {\n  for (const keyword of settings.keywords) {\n    scans.push({\n      json: {\n        name: competitor.name,\n        place_id: competitor.place_id,\n        keyword: keyword,\n        lat: settings.yourLocation.lat,\n        lng: settings.yourLocation.lng,\n        isYou: false\n      }\n    });\n  }\n}\n\nreturn scans;"
      },
      "id": "prepare-scans",
      "name": "Prepare Scan Requests",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        460
      ]
    },
    {
      "parameters": {
        "resource": "scan",
        "operation": "run",
        "platform": "google",
        "placeId": "={{ $json.place_id }}",
        "keyword": "={{ $json.keyword }}",
        "lat": "={{ $json.lat }}",
        "lng": "={{ $json.lng }}",
        "gridSize": 5,
        "radius": 1,
        "measurement": "mi"
      },
      "id": "run-scan",
      "name": "Run Competitive Scan",
      "type": "@local-falcon/n8n-nodes-localfalcon.localFalcon",
      "typeVersion": 1,
      "position": [
        920,
        460
      ],
      "credentials": {
        "localFalconApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const results = $input.all();\nconst settings = $('Competitive Settings').first().json;\n\n// Group by keyword\nconst byKeyword = {};\nfor (const result of results) {\n  const keyword = result.json.keyword || 'unknown';\n  if (!byKeyword[keyword]) byKeyword[keyword] = [];\n  byKeyword[keyword].push(result.json);\n}\n\nlet message = `:mag: *Weekly Competitive Analysis*\\n`;\nmessage += `_${new Date().toLocaleDateString()}_\\n\\n`;\n\nlet alerts = [];\n\nfor (const [keyword, rankings] of Object.entries(byKeyword)) {\n  message += `*Keyword: ${keyword}*\\n`;\n  \n  const sorted = rankings.sort((a, b) => (a.avg_rank || 99) - (b.avg_rank || 99));\n  let position = 1;\n  let yourRank = null;\n  \n  for (const rank of sorted) {\n    const icon = rank.isYou ? ':star:' : ':bust_in_silhouette:';\n    message += `${position}. ${icon} ${rank.name}: ${rank.avg_rank || 'N/A'}\\n`;\n    if (rank.isYou) yourRank = position;\n    position++;\n  }\n  \n  if (yourRank > 1) {\n    alerts.push(`You're #${yourRank} for \"${keyword}\"`);\n  }\n  message += '\\n';\n}\n\nif (alerts.length > 0) {\n  message = `:warning: *Competitive Alert*\\n${alerts.join('\\n')}\\n\\n` + message;\n}\n\nreturn [{\n  json: {\n    slackMessage: message,\n    slackChannel: settings.slackChannel,\n    hasAlerts: alerts.length > 0\n  }\n}];"
      },
      "id": "analyze",
      "name": "Analyze Competition",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1180,
        460
      ]
    }
  ],
  "connections": {
    "Every Monday 6am": {
      "main": [
        [
          {
            "node": "Competitive Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitive Settings": {
      "main": [
        [
          {
            "node": "Prepare Scan Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Scan Requests": {
      "main": [
        [
          {
            "node": "Run Competitive Scan",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Competitive Scan": {
      "main": [
        [
          {
            "node": "Analyze Competition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}