{
  "name": "REVOPS-LI-006 | 05 | Attribution report API",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "GET",
        "path": "revops-li-006-report",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "da6fc514-2761-4cde-80cb-aa0d5cc1cddd",
      "name": "Read Attribution Report",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "122dfaac-912a-46c4-a6db-58fb7d5fb4ec",
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_REPORT_SECRET_CREDENTIAL",
          "name": "ATTRIBUTION Report Secret"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const property_id='REPLACE_GA4_NUMERIC_PROPERTY_ID';if(!/^\\d+$/.test(property_id))throw new Error('Set GA4 property ID');return [{json:{tenant:'REVOPS-LI-006',property_id}}];"
      },
      "id": "5b8daf91-9c68-4377-b2f1-24721d9cd742",
      "name": "Report Configuration",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        270,
        0
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT attribution.report($1::text,$2::text) AS report;",
        "options": {
          "queryReplacement": "={{ [$json.tenant,$json.property_id] }}"
        }
      },
      "id": "7980d3bf-5b89-46e2-8268-97779bce3ba7",
      "name": "Build Combined Attribution Report",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        540,
        0
      ],
      "credentials": {
        "postgres": {
          "id": "REPLACE_POSTGRES_CREDENTIAL",
          "name": "ATTRIBUTION Postgres"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json.report }}",
        "options": {
          "responseCode": 200
        }
      },
      "id": "ba9b1e7e-c98d-4d71-9566-d983698b4feb",
      "name": "Return Report JSON",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        810,
        0
      ]
    },
    {
      "parameters": {
        "content": "## Authenticated report endpoint\nReturns GA4 overall totals and traffic breakdown, captured lead conversions, and attribution quality.\nNo lead emails, visitor IDs or raw payloads in this response.\nCampaign-level CRM conversions are capture-date counts, not session cohort conversion rates.",
        "width": 700,
        "height": 220
      },
      "id": "68563b14-6c40-44ba-88cb-294acd790e7f",
      "name": "Workflow Guide",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -270
      ]
    }
  ],
  "connections": {
    "Read Attribution Report": {
      "main": [
        [
          {
            "node": "Report Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Report Configuration": {
      "main": [
        [
          {
            "node": "Build Combined Attribution Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Combined Attribution Report": {
      "main": [
        [
          {
            "node": "Return Report JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timezone": "Asia/Tbilisi",
    "saveExecutionProgress": true
  },
  "active": false,
  "pinData": {},
  "tags": []
}

