{
  "name": "SEO Dashboard - GSC + GA4 + DataForSEO to Google Sheets",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 6 * * *"
            }
          ]
        }
      },
      "id": "schedule-trigger",
      "name": "Daily at 6am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "resource": "searchAnalytics",
        "siteUrl": "https://yourdomain.com",
        "startDate": "={{ $now.minus({days: 28}).toFormat('yyyy-MM-dd') }}",
        "endDate": "={{ $now.minus({days: 3}).toFormat('yyyy-MM-dd') }}",
        "dimensions": ["date"],
        "rowLimit": 1000
      },
      "id": "gsc-node",
      "name": "Google Search Console",
      "type": "n8n-nodes-base.googleSearchConsole",
      "typeVersion": 1,
      "position": [220, 0],
      "credentials": {
        "googleSearchConsoleOAuth2Api": {
          "id": "YOUR_GSC_CREDENTIAL_ID",
          "name": "Google Search Console OAuth2"
        }
      }
    },
    {
      "parameters": {
        "resource": "report",
        "viewId": "YOUR_GA4_VIEW_ID",
        "startDate": "={{ $now.minus({days: 28}).toFormat('yyyy-MM-dd') }}",
        "endDate": "={{ $now.minus({days: 1}).toFormat('yyyy-MM-dd') }}",
        "metrics": [
          { "expression": "ga:sessions" },
          { "expression": "ga:users" },
          { "expression": "ga:bounceRate" }
        ],
        "dimensions": [
          { "name": "ga:date" },
          { "name": "ga:sourceMedium" }
        ],
        "dimensionFilterClauses": {
          "filters": [
            {
              "dimensionName": "ga:sourceMedium",
              "operator": "EXACT",
              "expressions": ["google / organic"]
            }
          ]
        }
      },
      "id": "ga4-node",
      "name": "Google Analytics",
      "type": "n8n-nodes-base.googleAnalytics",
      "typeVersion": 1,
      "position": [220, 200],
      "credentials": {
        "googleAnalyticsOAuth2Api": {
          "id": "YOUR_GA_CREDENTIAL_ID",
          "name": "Google Analytics OAuth2"
        }
      }
    },
    {
      "parameters": {
        "resource": "serp",
        "keyword": "={{ $json.keyword }}",
        "location": "United Kingdom",
        "language": "English",
        "limit": 10
      },
      "id": "dataforseo-node",
      "name": "DataForSEO Rankings",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 400],
      "credentials": {
        "httpBasicAuth": {
          "id": "YOUR_DATAFORSEO_CREDENTIAL_ID",
          "name": "DataForSEO API"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "GSC Data",
        "columns": {
          "mappingMode": "autoMapInputData"
        }
      },
      "id": "sheets-gsc",
      "name": "Write GSC Data",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [440, 0],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "GA4 Data",
        "columns": {
          "mappingMode": "autoMapInputData"
        }
      },
      "id": "sheets-ga4",
      "name": "Write GA4 Data",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [440, 200],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "__rl": true, "mode": "id", "value": "YOUR_GOOGLE_SHEET_ID" },
        "sheetName": "Rankings Data",
        "columns": {
          "mappingMode": "autoMapInputData"
        }
      },
      "id": "sheets-rankings",
      "name": "Write Rankings Data",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [440, 400],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "your@email.com",
        "subject": "SEO Dashboard Weekly Summary",
        "message": "Your weekly SEO dashboard has been updated. Check your Google Sheet for the latest data."
      },
      "id": "email-node",
      "name": "Weekly Summary Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [660, 200],
      "credentials": {
        "smtp": {
          "id": "YOUR_SMTP_CREDENTIAL_ID",
          "name": "SMTP"
        }
      }
    }
  ],
  "connections": {
    "Daily at 6am": {
      "main": [
        [
          { "node": "Google Search Console", "type": "main", "index": 0 },
          { "node": "Google Analytics", "type": "main", "index": 0 },
          { "node": "DataForSEO Rankings", "type": "main", "index": 0 }
        ]
      ]
    },
    "Google Search Console": {
      "main": [
        [{ "node": "Write GSC Data", "type": "main", "index": 0 }]
      ]
    },
    "Google Analytics": {
      "main": [
        [{ "node": "Write GA4 Data", "type": "main", "index": 0 }]
      ]
    },
    "DataForSEO Rankings": {
      "main": [
        [{ "node": "Write Rankings Data", "type": "main", "index": 0 }]
      ]
    },
    "Write GA4 Data": {
      "main": [
        [{ "node": "Weekly Summary Email", "type": "main", "index": 0 }]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 1
}
