AutomationFlowsMarketing & Ads › Sync GA4 Data Every 12 Hours

Sync GA4 Data Every 12 Hours

Original n8n title: Ga4 Daily Sync - Every 12 Hours

GA4 Daily Sync - Every 12 Hours. Uses executeCommand. Scheduled trigger; 6 nodes.

Cron / scheduled trigger★★★★☆ complexity6 nodesExecute Command
Marketing & Ads Trigger: Cron / scheduled Nodes: 6 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "GA4 Daily Sync - Every 12 Hours",
  "nodes": [
    {
      "parameters": {
        "mode": "everyX",
        "value": 12,
        "unit": "hours",
        "triggerAtHour": 6
      },
      "id": "cron-trigger",
      "name": "Every 12 Hours (6AM & 6PM)",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "command": "python",
        "arguments": "ga4_sync.py",
        "workingDirectory": "C:\\Users\\USER\\marketing-ops-dashboard"
      },
      "id": "execute-ga4-sync",
      "name": "Execute GA4 Sync Script",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "success-condition",
              "leftValue": "={{ $node['Execute GA4 Sync Script'].json.exitCode }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "check-success",
      "name": "Check Execution Success",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "success-message",
              "name": "message",
              "value": "\u2705 GA4 \u6578\u64da\u540c\u6b65\u6210\u529f\u5b8c\u6210",
              "type": "string"
            },
            {
              "id": "success-timestamp",
              "name": "timestamp",
              "value": "={{ new Date().toISOString() }}",
              "type": "string"
            },
            {
              "id": "success-status",
              "name": "status",
              "value": "success",
              "type": "string"
            },
            {
              "id": "success-output",
              "name": "output",
              "value": "={{ $node['Execute GA4 Sync Script'].json.stdout }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "success-data",
      "name": "Success Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        900,
        200
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "error-message",
              "name": "message",
              "value": "\u274c GA4 \u6578\u64da\u540c\u6b65\u5931\u6557",
              "type": "string"
            },
            {
              "id": "error-timestamp",
              "name": "timestamp",
              "value": "={{ new Date().toISOString() }}",
              "type": "string"
            },
            {
              "id": "error-status",
              "name": "status",
              "value": "error",
              "type": "string"
            },
            {
              "id": "error-details",
              "name": "error",
              "value": "={{ $node['Execute GA4 Sync Script'].json.stderr }}",
              "type": "string"
            },
            {
              "id": "exit-code",
              "name": "exitCode",
              "value": "={{ $node['Execute GA4 Sync Script'].json.exitCode }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "id": "error-data",
      "name": "Error Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        900,
        400
      ]
    },
    {
      "parameters": {
        "content": "## GA4 \u540c\u6b65\u57f7\u884c\u5831\u544a\n\n**\u72c0\u614b**: {{ $json.status === 'success' ? '\u2705 \u6210\u529f' : '\u274c \u5931\u6557' }}\n**\u6642\u9593**: {{ $json.timestamp }}\n**\u8a0a\u606f**: {{ $json.message }}\n\n{{ $json.status === 'success' ? '**\u8f38\u51fa**:\\n```\\n' + $json.output + '\\n```' : '**\u932f\u8aa4\u8a73\u60c5**:\\n```\\n' + $json.error + '\\n```\\n**\u9000\u51fa\u4ee3\u78bc**: ' + $json.exitCode }}\n\n---\n*\u81ea\u52d5\u5316 GA4 \u6578\u64da\u540c\u6b65\u5de5\u4f5c\u6d41\u7a0b*",
        "options": {}
      },
      "id": "format-report",
      "name": "Format Report",
      "type": "n8n-nodes-base.markdown",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ]
    }
  ],
  "connections": {
    "Every 12 Hours (6AM & 6PM)": {
      "main": [
        [
          {
            "node": "Execute GA4 Sync Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute GA4 Sync Script": {
      "main": [
        [
          {
            "node": "Check Execution Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Execution Success": {
      "main": [
        [
          {
            "node": "Success Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success Data": {
      "main": [
        [
          {
            "node": "Format Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Data": {
      "main": [
        [
          {
            "node": "Format Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "ga4-daily-sync",
  "tags": [
    {
      "createdAt": "2024-01-01T00:00:00.000Z",
      "updatedAt": "2024-01-01T00:00:00.000Z",
      "id": "ga4-automation",
      "name": "GA4 Automation"
    }
  ]
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

GA4 Daily Sync - Every 12 Hours. Uses executeCommand. Scheduled trigger; 6 nodes.

Source: https://github.com/Aaron941001/marketing-ops-dashboard/blob/ff84cdcd33b290d71f883ad8ee375f48caf64b2d/ga4-automation/n8n-ga4-daily-sync-workflow.json — original creator credit. Request a take-down →

More Marketing & Ads workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Marketing & Ads

Post-event lead routing. Uses googleDrive, executeCommand, slack. Scheduled trigger; 6 nodes.

Google Drive, Execute Command, Slack
Marketing & Ads

Workflow A — WhatsApp Lead Intake & Qualification. Uses postgres, httpRequest, errorTrigger. Scheduled trigger; 67 nodes.

Postgres, HTTP Request, Error Trigger
Marketing & Ads

Build authentic Reddit presence and generate qualified leads through AI-powered community engagement that provides genuine value without spam or promotion.

HTTP Request, Reddit
Marketing & Ads

Ghost Rider CRM Import (Lead Processor). Uses httpRequest. Scheduled trigger; 40 nodes.

HTTP Request
Marketing & Ads

This workflow runs on scheduled weekly and monthly triggers to generate unified marketing performance reports. It processes multiple websites by collecting analytics data, paid ads performance, and CR

Gmail, Google Sheets, Google Analytics +3