MARKETING AUTOMATION & WORKFLOWS DAILY REPORTING & WORKFLOW AUTOMATION (N8N & ACTIVEPIECES)

Shopify & GA4 Daily Sales & Performance Reporting Automation: n8n & Activepieces

An automated daily reporting pipeline built on self-hosted n8n and Activepieces that extracts daily sales metrics from Shopify Admin API, pulls traffic and conversion data from GA4, updates Google Sheets, and dispatches executive morning email digests.

CATEGORY MARKETING AUTOMATION & WORKFLOWS
STACK & RUNTIME n8n (Self-Hosted) • Activepieces • Shopify Admin API • GA4 Data API v1beta • Google Sheets v4.5 • Gmail SMTP • JavaScript / TypeScript

Core Code Architecture:

n8n Dual-Source Aggregator & Daily Sales Metrics Code Node
n8n Dual-Source Aggregator & Daily Sales Metrics Code Node
javascript
                // n8n Code Node: Dual-Source Aggregator & Daily Sales Metrics
const dateContext = $("Compute Reporting Date Window").first().json;
const shopifyRaw = $("Shopify: Get Many Orders").first().json;
const ga4Raw = $("Google Analytics 4: Get Daily Report").first().json;

// 1. Process Shopify Orders (Financial Source of Truth)
const orders = Array.isArray(shopifyRaw) ? shopifyRaw : (shopifyRaw.orders || []);
let grossSales = 0, totalDiscounts = 0, totalTax = 0, totalRefunds = 0;
const skuVolume = {};

orders.forEach(ord => {
  grossSales += parseFloat(ord.subtotal_price || ord.total_price || 0);
  totalDiscounts += parseFloat(ord.total_discounts || 0);
  totalTax += parseFloat(ord.total_tax || 0);

  (ord.refunds || []).forEach(ref => {
    (ref.transactions || []).forEach(t => totalRefunds += parseFloat(t.amount || 0));
  });

  (ord.line_items || []).forEach(item => {
    const sku = item.sku || item.title || "Product";
    skuVolume[sku] = (skuVolume[sku] || 0) + (item.quantity || 1);
  });
});

const orderCount = orders.length;
const netSales = grossSales - totalDiscounts - totalRefunds;
const aov = orderCount > 0 ? (netSales / orderCount) : 0;

// Sort top SKUs
const topSkus = Object.entries(skuVolume)
  .sort((a, b) => b[1] - a[1])
  .slice(0, 2)
  .map(([name, qty]) => `${name} (${qty} sold)`);

// 2. Process GA4 Telemetry & Attribution
let ga4Revenue = 0, ga4Sessions = 0, ga4Transactions = 0;
if (ga4Raw.rows && ga4Raw.rows.length > 0) {
  ga4Revenue = ga4Raw.rows.reduce((sum, r) => sum + parseFloat(r.metricValues?.[0]?.value || 0), 0);
  ga4Sessions = ga4Raw.rows.reduce((sum, r) => sum + parseInt(r.metricValues?.[1]?.value || 0), 0);
  ga4Transactions = ga4Raw.rows.reduce((sum, r) => sum + parseInt(r.metricValues?.[2]?.value || 0), 0);
}
const conversionRate = ga4Sessions > 0 ? ((orderCount / ga4Sessions) * 100).toFixed(2) + "%" : "0.00%";

return [{
  json: {
    report_date: dateContext.report_date || new Date().toISOString().split('T')[0],
    shopify_orders: orderCount,
    shopify_gross: "$" + grossSales.toFixed(2),
    shopify_discounts: "$" + totalDiscounts.toFixed(2),
    shopify_refunds: "$" + totalRefunds.toFixed(2),
    shopify_net: "$" + netSales.toFixed(2),
    shopify_aov: "$" + aov.toFixed(2),
    ga4_revenue: "$" + ga4Revenue.toFixed(2),
    ga4_sessions: ga4Sessions,
    ecommerce_cr: conversionRate,
    top_sku_1: topSkus[0] || "N/A",
    top_sku_2: topSkus[1] || "N/A",
    logged_at: new Date().toISOString()
  }
}];
              

GTM Template & Configuration Screenshots:

Verified Sandbox Environment
n8n Visual Automation Canvas (Official Shopify & GA4 Nodes) GTM UI
n8n Visual Workflow Canvas for Shopify & GA4 Daily Sales Reporting Automation
Production n8n workflow pipeline running Schedule Trigger (Daily 08:00 UTC), querying official Shopify Get Many Orders and GA4 Get Daily Report nodes, computing aggregated daily sales and traffic in Code, appending to Google Sheets (Daily_Sales), and sending an Executive Digest via Gmail SMTP.
Activepieces Visual Automation Canvas GTM UI
Activepieces Visual Workflow Canvas for Shopify and GA4 Daily Sales Reporting Automation
Activepieces 5-step daily automation pipeline orchestrating Schedule Trigger (08:00 UTC), Date Window Code, Shopify Admin API Orders Ingestion, Google Sheets Daily Sales Append, and Gmail Executive Digest.
01

The Manual Morning Reporting Bottleneck Solved

E-commerce managers and marketing teams frequently lose 30 to 45 minutes every morning logging into disparate dashboards (Shopify Admin and Google Analytics 4), pulling raw CSV exports, manually calculating net sales and AOV in spreadsheets, and drafting executive update emails. This automation eliminates that manual grind completely.

  • Zero Manual Morning Effort: 100% automated workflow executing at 08:00 AM UTC every single day
  • Dual-Source Consolidation: Merges Shopify financial data (gross/net sales, discounts, refunds, top SKUs) with GA4 traffic telemetry (sessions, conversion rates)
  • Automated Google Sheets Ledger: Appends an audit-ready row to the tracking Google Sheet (Daily_Sales) automatically
  • Executive HTML Morning Email: Delivers a clean, formatted executive summary digest directly to stakeholders' inboxes
  • Dual-Platform Flexibility: Full operational blueprints provided for both self-hosted n8n and Activepieces
02

n8n Daily Sales Reporting Pipeline Architecture

Fires daily on a cron trigger, computes the yesterday reporting date window, queries Shopify Admin API for orders and GA4 Data API for traffic metrics in parallel, aggregates KPIs in a custom JavaScript code node, appends the structured row to Google Sheets, and sends an executive HTML email digest via Gmail SMTP.

Schedule Trigger (Daily 08:00 UTC) →
Shopify: Get Many Orders →
GA4: Get Daily Report →
Compute Daily Sales & AOV (Code) →
Google Sheets: Append Daily Sales →
Gmail SMTP: Send Executive Digest
03

Activepieces Daily Reporting Flow Architecture

Built as a streamlined 5-step flow on Activepieces: triggers daily on schedule, calculates the reporting date window via TypeScript/JavaScript code piece, ingests Shopify orders, logs the daily row into Google Sheets, and dispatches the HTML morning report email to the team.

Schedule Trigger (Daily 08:00) →
Date Window Generator (Code) →
Shopify Admin API Ingestion →
Google Sheets: Append Row →
Gmail: Send Daily Report Email
04

1-Click Importable Blueprints (n8n & Activepieces)

All workflows are provided as complete, production-ready JSON blueprints configured with node parameters, data mappings, Google Sheets schemas, and HTML email templates.

  • shopify-ga4-daily-sales-n8n-workflow.json: Production n8n workflow blueprint with official Shopify and GA4 nodes, Code Aggregator, Google Sheets logging, and Gmail SMTP digest (Available at /downloads/shopify-ga4-daily-sales-n8n-workflow.json)
  • shopify-ga4-daily-sales-activepieces-flow.json: Complete Activepieces flow blueprint with Schedule Trigger, Code piece, Shopify Admin API step, Google Sheets piece, and Gmail piece (Available at /downloads/shopify-ga4-daily-sales-activepieces-flow.json)