{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "7c9a0add-4047-47e0-8d27-53bf9a0b3951",
      "name": "Workflow Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 760,
        "height": 460,
        "content": "## \ud83d\udd0e Find Query Cannibalization (Google Search Console)\n\n**Purpose**\nDetect queries where **multiple pages** on your site compete and both receive clicks (true cannibalization).\n\n**How it works**\n1) Fetch last 12 months from GSC with dimensions **query** + **page**.\n2) Summarize by **query** \u2192 build arrays of pages and clicks per query.\n3) Filter \u2192 keep queries with **>1 page** AND **second page has clicks > 0**.\n\n**Before running**\n- Connect a **Google Search Console OAuth2** credential to the GSC node.\n- Replace `sc-domain:example.com` with your property (e.g., `sc-domain:your-domain.com`).\n\n**Tips**\n- For more robust results, consider summing clicks per page (use `sum` instead of `append`) and then filter for **\u2265 2 pages with clicks > 0**.\n- You can run ad\u2011hoc via **Manual Start** or automate via **Weekly Trigger**.\n\n**Output fields**\n- `query`, `appended_page[]`, `appended_clicks[]`, `count_query`\n\nTags: SEO, GSC, Cannibalization"
      },
      "typeVersion": 1
    },
    {
      "id": "fe090582-2798-4639-83e8-fd138e2f704d",
      "name": "Manual Start",
      "type": "n8n-nodes-base.start",
      "position": [
        304,
        512
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d2ea11e7-0342-4762-b338-d17254fa6a0d",
      "name": "Query Search Analytics",
      "type": "n8n-nodes-google-search-console.googleSearchConsole",
      "position": [
        528,
        512
      ],
      "parameters": {
        "siteUrl": "sc-domain:example.com",
        "rowLimit": 10000,
        "operation": "getPageInsights",
        "dimensions": [
          "query",
          "page"
        ],
        "dateRangeMode": "last12mo"
      },
      "credentials": {
        "googleSearchConsoleOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "345f7a46-c00a-44a1-87fa-f8b70cf795a3",
      "name": "Summarize by Query",
      "type": "n8n-nodes-base.summarize",
      "position": [
        752,
        512
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "query",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "query"
            },
            {
              "field": "page",
              "aggregation": "append"
            },
            {
              "field": "clicks",
              "aggregation": "append"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "27038010-a800-4a33-b22a-fbfdf82b5e8e",
      "name": "Filter Cannibal Queries",
      "type": "n8n-nodes-base.filter",
      "position": [
        976,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.count_query }}",
              "rightValue": 1
            },
            {
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.appended_clicks[1] }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    }
  ],
  "connections": {
    "Manual Start": {
      "main": [
        [
          {
            "node": "Query Search Analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize by Query": {
      "main": [
        [
          {
            "node": "Filter Cannibal Queries",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Search Analytics": {
      "main": [
        [
          {
            "node": "Summarize by Query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}