8
n8n 中文网amn8n.com

追踪网站流量与反向链接

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, EmailSend, FormTrigger 等节点。 使用 Ahref API 和 Google Sheets 追踪网站流量与反向链接

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e35fb337-0724-4e36-9d0e-1d064df566f7",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "6f2e148a-8220-4a88-8508-c3f6d6ea0192",
      "parameters": {
        "options": {},
        "formTitle": "Website Traffic Checker",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Domain",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "20601b36-f688-4241-901f-92a606ff3a56",
      "name": "设置域名值",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2119e477-af9d-4cb1-8729-2e62c8ffd23e",
              "name": "Domain",
              "type": "string",
              "value": "={{ $json.Domain }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d6b3586a-136f-436d-a0b4-d2a3eaeb7715",
      "name": "检查网站流量 API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        464,
        0
      ],
      "parameters": {
        "url": "https://website-traffic-checker-ahref.p.rapidapi.com/check-traffic.php",
        "method": "POST",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "domain",
              "value": "={{ $json.Domain }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "website-traffic-checker-ahref.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "59a6d92f-39b2-48b9-83db-96300ebe5cfc",
      "name": "检查 API 调用是否成功",
      "type": "n8n-nodes-base.if",
      "position": [
        784,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d8ec3848-a4b9-47f1-bbf7-4097c45aa97e",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.statusCode }}",
              "rightValue": 200
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "035c2cd8-5681-455a-9cb3-57e9b4328805",
      "name": "发送失败邮件警报",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1088,
        464
      ],
      "webhookId": "fc7f3b45-0a59-4f07-ba2e-a150c69a8801",
      "parameters": {
        "html": "=Dear Team,\n\nThis is to inform you that the system failed to retrieve data for: {{ $('Set Domain Value').item.json.Domain }}.\n\nStatus Code: {{ $json.statusCode }}\n\nKindly take note of this issue and do the needful at the earliest.\n\nRegards,  \nn8n Automation\n",
        "options": {},
        "subject": "=Failed to Retrieve Data for - {{ $('Set Domain Value').item.json.Domain }}",
        "toEmail": "user@test.com",
        "fromEmail": "admin@test.com"
      },
      "credentials": {
        "smtp": {
          "id": "nPwKPPgVavimTJX4",
          "name": "SMTP account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "55b516b2-065e-4f2b-bf45-f6d776d16392",
      "name": "提取反向链接信息",
      "type": "n8n-nodes-base.code",
      "position": [
        1072,
        -128
      ],
      "parameters": {
        "jsCode": "return $input.first().json.body.backlinks_info;"
      },
      "typeVersion": 2
    },
    {
      "id": "abfddbea-a012-41e2-b52a-0a88771ea9c7",
      "name": "记录反向链接到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        -128
      ],
      "parameters": {
        "columns": {
          "value": {
            "ascore": "={{ $json.data.ascore }}",
            "website": "={{ $('Set Domain Value').item.json.Domain }}",
            "total backlinks": "={{ $json.data.total }}",
            "referring domain": "={{ $json.data.domains }}"
          },
          "schema": [
            {
              "id": "website",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ascore",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ascore",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "referring domain",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "referring domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total backlinks",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total backlinks",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Backlink Info"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "23991e01-055f-45ae-ae78-b3d1ea59b6f3",
      "name": "提取流量信息",
      "type": "n8n-nodes-base.code",
      "position": [
        1344,
        224
      ],
      "parameters": {
        "jsCode": "return $input.first().json.body.traffic_analysis;"
      },
      "typeVersion": 2
    },
    {
      "id": "35bd8043-541c-43e9-a8ee-68b1e9ae7194",
      "name": "记录流量到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1776,
        368
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "accuracy",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "accuracy",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "bounce_rate",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "bounce_rate",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "desktop_share",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "desktop_share",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "direct",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "direct",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "display_ad",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "display_ad",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "display_date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "display_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mail",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "mail",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "mobile_share",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "mobile_share",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pages_per_visit",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "pages_per_visit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "paid",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "paid",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_bounce_rate",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_bounce_rate",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_direct",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_direct",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_display_ad",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_display_ad",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_mail",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_mail",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_pages_per_visit",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_pages_per_visit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_referral",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_referral",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_search_organic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_search_organic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_search_paid",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_search_paid",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_social_organic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_social_organic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_social_paid",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_social_paid",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_time_on_site",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_time_on_site",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_users",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_users",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "prev_visits",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "prev_visits",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "rank",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "rank",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "referral",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "referral",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "search",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "search",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "search_organic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "search_organic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "search_paid",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "search_paid",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "social",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "social",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "social_organic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "social_organic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "social_paid",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "social_paid",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "target",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "target",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "time_on_site",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "time_on_site",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "unknown_channel",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "unknown_channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "users",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "users",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "visits",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "visits",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1530109257,
          "cachedResultUrl": "",
          "cachedResultName": "Traffic Data"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "6678ef4e-aedc-4a23-8444-f9ccc4272cfb",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -160
      ],
      "parameters": {
        "height": 304,
        "content": "当用户提交包含域名的表单时触发工作流。捕获必填的域名输入字段。"
      },
      "typeVersion": 1
    },
    {
      "id": "cd942b09-5757-4789-b5d0-289ad83628a6",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -160
      ],
      "parameters": {
        "height": 304,
        "content": "将提交的域名值存储到变量 Domain 中以便重复使用。确保在整个工作流中引用一致。"
      },
      "typeVersion": 1
    },
    {
      "id": "13ada3da-5313-4bdf-8625-2eabb8e09b44",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -160
      ],
      "parameters": {
        "height": 304,
        "content": "向 RapidAPI 端点发送包含提交域名的 POST 请求。包含必需的请求头和多部分表单数据以确保 API 兼容性。"
      },
      "typeVersion": 1
    },
    {
      "id": "b5a992d1-d024-40ce-a2a8-075e4b1ca3c9",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        -160
      ],
      "parameters": {
        "height": 304,
        "content": "检查 API 响应是否返回 HTTP 状态码 200。根据调用成功或失败进行分支处理。"
      },
      "typeVersion": 1
    },
    {
      "id": "217c0e5a-b6be-4727-ab2d-473701b617be",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        304
      ],
      "parameters": {
        "height": 320,
        "content": "如果 API 调用失败则发送邮件警报。消息中包含失败的域名和 HTTP 状态码。"
      },
      "typeVersion": 1
    },
    {
      "id": "61d200d6-be52-45b7-8bb6-dea56b990f71",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        -272
      ],
      "parameters": {
        "height": 288,
        "content": "从 API 响应体中提取 backlinks_info 对象。此数据将记录到反向链接表格中。"
      },
      "typeVersion": 1
    },
    {
      "id": "5c01e269-2126-433e-83de-8c724cef80ee",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        -288
      ],
      "parameters": {
        "height": 304,
        "content": "将反向链接相关数据追加到\"反向链接信息\"表格。记录如 ascore、引用域和总反向链接等值。"
      },
      "typeVersion": 1
    },
    {
      "id": "ef3260d7-50df-489f-80ed-680a4b7e79af",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1296,
        96
      ],
      "parameters": {
        "height": 256,
        "content": "从 API 响应体中提取 traffic_analysis 数据。准备要记录的流量指标。"
      },
      "typeVersion": 1
    },
    {
      "id": "674fdc56-0348-4fc4-8183-75d3baf238ef",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        272
      ],
      "parameters": {
        "height": 256,
        "content": "将网站流量数据追加到\"流量数据\"表格。自动将 API 响应中的字段映射到表格列。"
      },
      "typeVersion": 1
    },
    {
      "id": "6d342474-b007-495c-801d-b59d28bb227b",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -320
      ],
      "parameters": {
        "width": 592,
        "height": 784,
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Set Domain Value": {
      "main": [
        [
          {
            "node": "Check Website Traffic API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Set Domain Value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Traffic Info": {
      "main": [
        [
          {
            "node": "Log Traffic to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Backlink Info": {
      "main": [
        [
          {
            "node": "Log Backlinks to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Failure Email Alert": {
      "main": [
        []
      ]
    },
    "Check Website Traffic API": {
      "main": [
        [
          {
            "node": "Check if API Call Succeeded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if API Call Succeeded": {
      "main": [
        [
          {
            "node": "Extract Backlink Info",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Traffic Info",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Failure Email Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流