{
  "name": "Automate unified marketing reports with Google Analytics, Google Ads, Meta Ads & HubSpot",
  "nodes": [
    {
      "id": "69cfdcf4-053e-4b62-86f7-e6f7325450a0",
      "name": "Schedule Trigger2",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        336,
        192
      ]
    },
    {
      "id": "8411350a-3755-448c-95d0-1ac10b229b97",
      "name": "Schedule Trigger3",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        336,
        368
      ]
    },
    {
      "id": "d5a47b0e-7e71-4436-ae3f-a95cc6001d56",
      "name": "check month and week1",
      "type": "n8n-nodes-base.code",
      "position": [
        608,
        272
      ]
    },
    {
      "id": "490ca0c7-ca5a-41c4-ac6b-4a6a4f602fd6",
      "name": "Set Websites and Campaings1",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        272
      ]
    },
    {
      "id": "b67d78e4-f6ea-45a1-bbdd-258deedc10fd",
      "name": "Loop Websites1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1520,
        272
      ]
    },
    {
      "id": "30b50688-b6c1-4907-a204-b42900da4542",
      "name": "Send Weekly Marketing report2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3424,
        272
      ]
    },
    {
      "id": "25473a12-d5ee-4bd6-aa3c-3f40ea4798c3",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        3184,
        464
      ]
    },
    {
      "id": "5e1318b5-c500-44a4-a92e-7f8ef9f3944a",
      "name": "Send Monthly Marketing Report2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3424,
        608
      ]
    },
    {
      "id": "10c7e88a-93b0-43dd-9d5c-30f4c2f70794",
      "name": "Expand Websites1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1088,
        272
      ]
    },
    {
      "id": "c94076e1-9e2b-4f69-850c-054c1ab6331d",
      "name": "Attach Run Flags1",
      "type": "n8n-nodes-base.set",
      "position": [
        1296,
        272
      ]
    },
    {
      "id": "36a8c671-1452-4cf8-9519-18ed9422f3d3",
      "name": "Filter Google Ads By Website1",
      "type": "n8n-nodes-base.code",
      "position": [
        2048,
        448
      ]
    },
    {
      "id": "f20bae59-a657-4d5e-8543-57ce6fc2c4a3",
      "name": "Filter Meta Ads By Website1",
      "type": "n8n-nodes-base.code",
      "position": [
        2048,
        608
      ]
    },
    {
      "id": "6d8c5ddd-a3d2-4559-b113-cb46d429219b",
      "name": "Build Website Dataset1",
      "type": "n8n-nodes-base.code",
      "position": [
        2480,
        368
      ]
    },
    {
      "id": "4c835c56-8565-4d7c-abae-059bac1d6733",
      "name": "Merge1",
      "type": "n8n-nodes-base.merge",
      "position": [
        2304,
        352
      ]
    },
    {
      "id": "fb78a801-9660-4b40-93c1-ec6b172157de",
      "name": "Calculate KPIs & Campaign Insights1",
      "type": "n8n-nodes-base.code",
      "position": [
        2656,
        576
      ]
    },
    {
      "id": "929c0e9c-8f6f-4856-b768-5261f6e9458d",
      "name": "Filter Hubspot Leads",
      "type": "n8n-nodes-base.code",
      "position": [
        1712,
        1232
      ]
    },
    {
      "id": "8a10efe3-fdf4-4310-ba26-11958b696e93",
      "name": "Summarize Hubspot Leads",
      "type": "n8n-nodes-base.code",
      "position": [
        1936,
        1232
      ]
    },
    {
      "id": "5beab407-6357-45a4-abdb-ff11e4504cbc",
      "name": "Prepare Report Data2",
      "type": "n8n-nodes-base.code",
      "position": [
        2928,
        464
      ]
    },
    {
      "id": "02b36b48-a3d7-4b76-8622-7bfee68f3125",
      "name": "Send Weekly Marketing report3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2688,
        1040
      ]
    },
    {
      "id": "62106fee-dfc6-45c4-9c39-24ee05274693",
      "name": "Switch3",
      "type": "n8n-nodes-base.switch",
      "position": [
        2448,
        1232
      ]
    },
    {
      "id": "c7369ab0-5bca-4460-8f4b-24735ee9bc1d",
      "name": "Send Monthly Marketing Report3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2688,
        1376
      ]
    },
    {
      "id": "7a083eaa-9581-4a46-ad46-c7966bbe1ceb",
      "name": "Prepare Report Data3",
      "type": "n8n-nodes-base.code",
      "position": [
        2192,
        1232
      ]
    },
    {
      "id": "159f0b87-3443-488e-8499-08ee4d05fbed",
      "name": "Append or update row in sheet2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1824,
        32
      ]
    },
    {
      "id": "6ff6d4c4-4b44-4c38-9c90-030696fc2b1f",
      "name": "Code in JavaScript1",
      "type": "n8n-nodes-base.code",
      "position": [
        2912,
        1376
      ]
    },
    {
      "id": "f7ba1482-eb71-49db-b1a9-25453a3bf7cc",
      "name": "Append or update row in sheet3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3120,
        1376
      ]
    },
    {
      "id": "64c18f37-cdb0-46de-8bbd-1c82273a18b8",
      "name": "Get a report",
      "type": "n8n-nodes-base.googleAnalytics",
      "position": [
        1824,
        304
      ]
    },
    {
      "id": "015e5bff-792c-4c30-bb5a-4be20a7472aa",
      "name": "Get many campaigns",
      "type": "n8n-nodes-base.googleAds",
      "position": [
        1824,
        448
      ]
    },
    {
      "id": "e2172991-3ad7-48a5-848d-c5a6906344ce",
      "name": "Fetch Meta Ads",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1824,
        608
      ]
    },
    {
      "id": "b01a1e30-c993-44a3-8a8d-fdcaaffea4ad",
      "name": "Fetch1",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1488,
        1232
      ]
    },
    {
      "id": "c947d90b-30de-40dc-9a33-8c35d6472d14",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -176
      ],
      "parameters": {
        "width": 672,
        "height": 992,
        "content": "## Unified Marketing Intelligence & Reporting Automation\n\nThis workflow automatically collects, analyzes, and reports marketing performance data across websites, paid ads, and CRM systems. It eliminat"
      }
    },
    {
      "id": "ceec494a-c50a-44e0-8533-512f9f36144a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -176
      ],
      "parameters": {
        "width": 1136,
        "height": 992,
        "content": "## Step 1: Trigger & Report Type Detection\nScheduled triggers decide whether the workflow runs weekly or monthly and set flags used throughout the workflow.\n"
      }
    },
    {
      "id": "04048207-9680-4412-b7de-b323e6497e80",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        -176
      ],
      "parameters": {
        "width": 1360,
        "height": 992,
        "content": "## Step 2: Website & Ads Data Processing\nLoops through each website, fetches analytics and ad data, filters campaigns, merges sources, and calculates performance KPIs.\n"
      }
    },
    {
      "id": "56197f7a-00c0-48ac-95da-9274962dc3cd",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2832,
        -176
      ],
      "parameters": {
        "width": 880,
        "height": 992,
        "content": "## Step 2.1: Marketing Report Generation\nCombines all website performance data and sends a clean weekly or monthly marketing report via email.\n"
      }
    },
    {
      "id": "5cd382c8-2ce2-414a-b90d-cb5131ca6e06",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        864
      ],
      "parameters": {
        "width": 928,
        "height": 864,
        "content": "## Step 3: HubSpot Lead Analysis\nFetches HubSpot leads, filters by reporting period, and summarizes lead status and lifecycle metrics.\n"
      }
    },
    {
      "id": "0a9977ec-3b7f-492b-bf1f-7ccbbc77050b",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2400,
        864
      ],
      "parameters": {
        "width": 960,
        "height": 864,
        "content": "## Step 3.1: CRM Reporting & Storage\nSends HubSpot lead summary reports and stores detailed CRM data in Google Sheets for long-term analysis.\n"
      }
    }
  ],
  "connections": {
    "Fetch1": {
      "main": [
        [
          {
            "node": "Filter Hubspot Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Build Website Dataset1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Send Weekly Marketing report2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Monthly Marketing Report2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch3": {
      "main": [
        [
          {
            "node": "Send Weekly Marketing report3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Monthly Marketing Report3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a report": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Meta Ads": {
      "main": [
        [
          {
            "node": "Filter Meta Ads By Website1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Websites1": {
      "main": [
        [
          {
            "node": "Append or update row in sheet2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get a report",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get many campaigns",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Meta Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expand Websites1": {
      "main": [
        [
          {
            "node": "Attach Run Flags1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Attach Run Flags1": {
      "main": [
        [
          {
            "node": "Loop Websites1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger2": {
      "main": [
        [
          {
            "node": "check month and week1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger3": {
      "main": [
        [
          {
            "node": "check month and week1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many campaigns": {
      "main": [
        [
          {
            "node": "Filter Google Ads By Website1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "Append or update row in sheet3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Hubspot Leads": {
      "main": [
        [
          {
            "node": "Summarize Hubspot Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Report Data2": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Report Data3": {
      "main": [
        [
          {
            "node": "Switch3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check month and week1": {
      "main": [
        [
          {
            "node": "Set Websites and Campaings1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Website Dataset1": {
      "main": [
        [
          {
            "node": "Calculate KPIs & Campaign Insights1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize Hubspot Leads": {
      "main": [
        [
          {
            "node": "Prepare Report Data3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Meta Ads By Website1": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Set Websites and Campaings1": {
      "main": [
        [
          {
            "node": "Expand Websites1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Google Ads By Website1": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send Monthly Marketing Report3": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate KPIs & Campaign Insights1": {
      "main": [
        [
          {
            "node": "Loop Websites1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare Report Data2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}