Gmail node
Google Analytics node
+3

Automate Google Analytics Reporting

Published 6 hours ago

Created by

alexk1919
Alex Kim

Template description

Automate Google Analytics Reporting with n8n

This n8n workflow collects, processes, and formats Google Analytics data into a comprehensive HTML report. The report is segmented into three primary categories: Engagement Stats, Search Results, and Country Views. The formatted report can be emailed or saved as a document, and the workflow includes error handling and logging for better debugging.

Overview

Purpose

To automate the extraction, processing, and presentation of Google Analytics data in a visually appealing and structured format for easier insights and decision-making.

Features

  • Data Parsing: Individual parsers process raw Google Analytics data for different time periods and categories.
  • Data Aggregation: Combines parsed data into a single structured JSON object.
  • HTML Report Generation: Formats the aggregated data into an HTML table with color-coded segments for better readability.
  • Email or Document Output: The formatted report can be emailed or saved as a Google Doc (will need additional setup).
  • Error Handling: Includes checks for missing data and detailed error messages for debugging.

Workflow Steps

  1. Data Fetching:

    • Six separate Google Analytics data pulls:
      • Page Engagement Stats (This Week and Prior Week)
      • Google Search Results (This Week and Prior Week)
      • Country Views (This Week and Prior Week)
  2. Data Parsing:

    • Each data pull is processed using a dedicated parser node to generate a URL-safe string.
    • Example nodes:
      • Parse - Get Page Engagement This Week
      • Parse - Country Views Prior Week
  3. Data Aggregation:

    • Aggregates parsed data into a structured JSON object using the Aggregate Data node.
    • Ensures consistency and handles missing or malformed data.
  4. HTML Report Generation:

    • Creates a formatted HTML report with color-coded tables for each segment:
      • Engagement Stats: Green
      • Search Results: Blue
      • Country Views: Orange
    • Includes headers and neatly formatted tables for each data set.
  5. Output:

    • The report can be sent via email using the Gmail API or saved to Google Docs.
    • Example nodes:
      • Gmail node for email delivery.
      • Google Docs node for saving the report as a document.

Requirements

Prerequisites

  • Google Cloud Setup:
    • Enable Google Analytics API.
    • Enable Gmail API (if using email output).
    • Generate OAuth credentials for API access.
  • n8n Installation:

Environment Variables

  • Ensure API credentials and tokens are set up in the n8n environment.
  • Update the respective nodes with client ID, client secret, and access tokens.

Configuration

Google Analytics

  • Configure the Get Report nodes with the appropriate property ID and metrics.
  • Ensure correct date ranges are selected for each node.

Formatting Node

  • The Format Data node processes aggregated data and generates the HTML content.
  • Customize the HTML styling and segment colors as needed.

Email Node

  • Configure the Gmail node with OAuth credentials.
  • Set the recipient email address and subject line dynamically.

Error Handling

Common Issues

  1. Authentication Errors:

    • Ensure OAuth credentials are correct.
    • Verify that the APIs are enabled in the Google Cloud Console.
  2. Empty Data:

    • Check the raw data from Google Analytics.
    • Validate the property ID and query parameters in the Get Report nodes.
  3. Parsing Errors:

    • Ensure the parser nodes are correctly configured and match the expected input format.

Debugging

  • Use debug logs in each node to identify data flow issues.
  • Add error-handling nodes to capture and log issues during execution.

Example Usage

  1. Run the Workflow
    • Trigger the workflow to fetch, process, and format Google Analytics data.
  2. Verify Output
    • Check the formatted HTML output in the debug logs.
    • Ensure the email or Google Doc contains the correctly formatted report.

Future Enhancements

  • Add support for additional metrics or dimensions.
  • Integrate with Slack for notifications.
  • Enable scheduling for automated reports.
  • Add a visual dashboard for real-time analytics.

Share Template

More Product workflow templates

Google Sheets node
+5

🚀 Boost your customer service with this WhatsApp Business bot!

This n8n workflow demonstrates how to automate customer interactions and appointment management via WhatsApp Business bot. After submitting a Google Form, the user receives a notification via WhatsApp. These notifications are sent via a template message. In case user sends a message to the bot, the text and user data is stored in Google Sheets. To reply back to the user, fill in the ReplyText column and change the Status to 'Ready'. In a few seconds n8n will fetch the unsent replies and deliver them one by one via WhatsApp Business node. Customize this workflow to fit your specific needs, connect different online services and enhance your customer communication! 🎉 Setup Instructions To get this workflow up and running, you'll need to: 👇 Create a WhatsApp template message on the Meta Business portal. Obtain an Access Token and WhatsApp Business Account ID from the Meta Developers Portal. This is needed for the WhatsApp Business Node to send messages. Set up a WhatsApp Trigger node with App ID and App Secret from the Meta Developers Portal. Right after that copy the WhatsApp Trigger URL and add it as a Callback URL in the Meta Developers Portal. This trigger is needed to receive incoming messages and their status updates. Connect your Google Sheets account for data storage and management. Check out the documentation page. ⚠️ Important Notes WhatsApp allows automatic custom text messages only within 24 hours of the last user message. Outside with time frame only approved template messages can be sent. The workflow uses a Google Sheet to manage form submissions, incoming messages and prepare responses. You can replace these nodes and connect the WhatsApp bot with other systems.
eduard
Eduard
HTTP Request node
Google Drive node
Google Calendar node
+9

Actioning Your Meeting Next Steps using Transcripts and AI

This n8n workflow demonstrates how you can summarise and automate post-meeting actions from video transcripts fed into an AI Agent. Save time between meetings by allowing AI handle the chores of organising follow-up meetings and invites. How it works This workflow scans for the calendar for client or team meetings which were held online. * Attempts will be made to fetch any recorded transcripts which are then sent to the AI agent. The AI agent summarises and identifies if any follow-on meetings are required. If found, the Agent will use its Calendar Tool to to create the event for the time, date and place for the next meeting as well as add known attendees. Requirements Google Calendar and the ability to fetch Meeting Transcripts (There is a special OAuth permission for this action!) OpenAI account for access to the LLM. Customising the workflow This example only books follow-on meetings but could be extended to generate reports or send emails.
jimleuk
Jimleuk
Notion node
Code node
+6

Notion AI Assistant Generator

This n8n workflow template lets teams easily generate a custom AI chat assistant based on the schema of any Notion database. Simply provide the Notion database URL, and the workflow downloads the schema and creates a tailored AI assistant designed to interact with that specific database structure. Set Up Watch this quick set up video 👇 Key Features Instant Assistant Generation**: Enter a Notion database URL, and the workflow produces an AI assistant configured to the database schema. Advanced Querying**: The assistant performs flexible queries, filtering records by multiple fields (e.g., tags, names). It can also search inside Notion pages to pull relevant content from specific blocks. Schema Awareness**: Understands and interacts with various Notion column types like text, dates, and tags for accurate responses. Reference Links**: Each query returns direct links to the exact Notion pages that inform the assistant’s response, promoting transparency and easy access. Self-Validation**: The workflow has logic to check the generated assistant, and if any errors are detected, it reruns the agent to fix them. Ideal for Product Managers**: Easily access and query product data across Notion databases. Support Teams**: Quickly search through knowledge bases for precise information to enhance support accuracy. Operations Teams**: Streamline access to HR, finance, or logistics data for fast, efficient retrieval. Data Teams**: Automate large dataset queries across multiple properties and records. How It Works This AI assistant leverages two HTTP request tools—one for querying the Notion database and another for retrieving data within individual pages. It’s powered by the Anthropic LLM (or can be swapped for GPT-4) and always provides reference links for added transparency.
max-n8n
Max Tkacz

More Marketing workflow templates

Google Sheets node
HTTP Request node
Merge node
+4

OpenAI GPT-3: Company Enrichment from website content

Enrich your company lists with OpenAI GPT-3 ↓ You’ll get valuable information such as: Market (B2B or B2C) Industry Target Audience Value Proposition This will help you to: add more personalization to your outreach make informed decisions about which accounts to target I've made the process easy with an n8n workflow. Here is what it does: Retrieve website URLs from Google Sheets Extract the content for each website Analyze it with GPT-3 Update Google Sheets with GPT-3 data
lempire
Lucas Perret
Google Sheets node
HTTP Request node
Microsoft Excel 365 node
Gmail node
+5

Automated Web Scraping: email a CSV, save to Google Sheets & Microsoft Excel

How it works: The workflow starts by sending a request to a website to retrieve its HTML content. It then parses the HTML extracting the relevant information The extracted data is storted and converted into a CSV file. The CSV file is attached to an email and sent to your specified address. The data is simultaneously saved to both Google Sheets and Microsoft Excel for further analysis or use. Set-up steps: Change the website to scrape in the "Fetch website content" node Configure Microsoft Azure credentials with Microsoft Graph permissions (required for the Save to Microsoft Excel 365 node) Configure Google Cloud credentials with access to Google Drive, Google Sheets and Gmail APIs (the latter is required for the Send CSV via e-mail node).
mihailtd
Mihai Farcas
HTTP Request node
Merge node
+5

Personalize marketing emails using customer data and AI

This workflow uses AI to analyze customer sentiment from product feedback. If the sentiment is negative, AI will determine whether offering a coupon could improve the customer experience. Upon completing the sentiment analysis, the workflow creates a personalized email templates. This solution streamlines the process of engaging with customers post-purchase, particularly when addressing dissatisfaction, and ensures that outreach is both personalized and automated. This workflow won the 1st place in our last AI contest. Note that to use this template, you need to be on n8n version 1.19.4 or later.
n8n-team
n8n Team

Implement complex processes faster with n8n

red icon yellow icon red icon yellow icon