{
  "id": "CVhjbHc5iwByseQz",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Pull references from Google AI Mode with DataForSEO",
  "tags": [],
  "nodes": [
    {
      "id": "f606faa7-1fca-4eb4-aad2-9c82bbaa9cea",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -100
      ],
      "parameters": {
        "color": 7,
        "height": 80,
        "content": "Specify the necessary **Keyword**, **Location**, and **Language** you want to get data for."
      },
      "typeVersion": 1
    },
    {
      "id": "be09cc7b-4c2d-40f8-893c-755122d65047",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        -100
      ],
      "parameters": {
        "color": 7,
        "height": 80,
        "content": "Select the necessary Google Sheet that contains the **Source**, **Domain**, **URL**, **Title**, and **Text** columns."
      },
      "typeVersion": 1
    },
    {
      "id": "afcc9426-0591-4a24-bf30-afa467c28e5f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -100
      ],
      "parameters": {
        "color": 7,
        "width": 200,
        "height": 80,
        "content": "The flow will run every 7 days. Adjust the schedule if needed."
      },
      "typeVersion": 1
    },
    {
      "id": "e7138f2a-e414-45ac-a8e4-41798480a55d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -100
      ],
      "parameters": {
        "width": 380,
        "height": 260,
        "content": "This n8n template automatically collects all source references from Google\u2019s AI Mode for any keyword you choose using DataForSEO and Google Sheets. \n\nWhat it does:\n\n* Uses DataForSEO API to fetch AI Mode results.\n* Extracts the source title, URL, and domain.\n* Stores the data in Google Sheets.\n\nYou can use this data to track your website\u2019s presence in AI Mode answers.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c0ba2993-9708-432a-9353-e3b1f9fda58b",
      "name": "Run evry 7 days",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "daysInterval": 7
            }
          ]
        }
      },
      "notesInFlow": false,
      "typeVersion": 1.2
    },
    {
      "id": "545835d7-7da9-4dfb-a0b4-d618da31435b",
      "name": "Split Out (items)",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        460,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "tasks[0].result[0].items"
      },
      "typeVersion": 1
    },
    {
      "id": "b7917336-5e23-49d5-9cab-cfb10e78cafa",
      "name": "Split Out (references)",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        700,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "references"
      },
      "typeVersion": 1
    },
    {
      "id": "37ae2031-7da4-496f-b465-c6969d560044",
      "name": "Get Google AI Mode SERP Data",
      "type": "n8n-nodes-dataforseo.dataForSeo",
      "position": [
        220,
        0
      ],
      "parameters": {
        "keyword": "why sky is blue",
        "resource": "serp",
        "operation": "get-google-ai-mode-serp",
        "language_name": "english",
        "location_name": "united states",
        "browser_screen_width": {},
        "browser_screen_height": {},
        "browser_screen_resolution_ratio": {}
      },
      "credentials": {
        "dataForSeoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "54494d77-cc14-4ce7-9077-690edfde42e5",
      "name": "Record references to your Google Sheet.",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        920,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $json.url }}",
            "Text": "={{ $json.text }}",
            "Title": "={{ $json.title }}",
            "Domain": "={{ $json.domain }}",
            "Source": "={{ $json.source }}"
          },
          "schema": [
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Text",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Text",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XCjkjyVxrtpTUQenHeR3B07xfEZ489mhuVidjhGOO7I/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1XCjkjyVxrtpTUQenHeR3B07xfEZ489mhuVidjhGOO7I",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XCjkjyVxrtpTUQenHeR3B07xfEZ489mhuVidjhGOO7I/edit?usp=drivesdk",
          "cachedResultName": "Scraping references from AI Mode"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d6fc98d6-e703-4b61-b17c-0af4f3f40d2f",
  "connections": {
    "Run evry 7 days": {
      "main": [
        [
          {
            "node": "Get Google AI Mode SERP Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out (items)": {
      "main": [
        [
          {
            "node": "Split Out (references)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out (references)": {
      "main": [
        [
          {
            "node": "Record references to your Google Sheet.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Google AI Mode SERP Data": {
      "main": [
        [
          {
            "node": "Split Out (items)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record references to your Google Sheet.": {
      "main": [
        []
      ]
    }
  }
}