[Modèle] Rapport GA4
Ceci est unMiscellaneous, AI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 13 nœuds.Utilise principalement des nœuds comme Code, Gmail, FormTrigger, HttpRequest, Agent. Créer et envoyer des rapports automatisés GA4 KPI avec IA, Gmail et des analyses
- •Compte Google et informations d'identification Gmail API
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Clé API OpenAI
Nœuds utilisés (13)
Catégorie
{
"id": "JuXOZQggRREMehEs",
"meta": {
"instanceId": "ec3694b688f9802e6ff1f61802ca6bc63a40ecfa76d32f2c71cfdf2978426fce",
"templateCredsSetupCompleted": true
},
"name": "[TEMPLATE] GA4 Report",
"tags": [],
"nodes": [
{
"id": "65978710-1149-45f7-9904-ebad886098ca",
"name": "Modèle de chat OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
32,
192
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "CDLerpKjR5nOKRIT",
"name": "OpenAi account main"
}
},
"typeVersion": 1.2
},
{
"id": "c4eb2b73-0dc8-4da0-a9ab-3d59e84a291a",
"name": "Calculatrice",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
192,
192
],
"parameters": {},
"typeVersion": 1
},
{
"id": "025324ca-92fe-4faf-96e0-71f81c25bcfe",
"name": "Agent IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
32,
-32
],
"parameters": {
"text": "=Form Submits Last Period - {{ JSON.stringify($('Form Submits This Period').first().json) }}\nForm Submits Previous Period - {{ JSON.stringify($('Form Submits Previous Period').first().json) }}\nMetrics Last Period - {{ JSON.stringify($('Overall Metrics This Period').first().json) }}\nMetrics Previous Period - {{ JSON.stringify($('Overall Metrics Previous Period').first().json) }}\n\n{{ $now }}\n\nUse the following instructions to generate a GA4‐based HTML monthly report for VertoDigital. Fill in every placeholder, apply the date ranges and percent‐change logic, and follow the Section guidelines below. Output only the final HTML—no code fences, no extra commentary.\n\nData Inputs (replace the {} tokens with real values):\n\nDate ranges:\n\nLast Period {date_range_0} - {{ $('Code').first().json['Report from start date'] }} to {{ $('Code').first().json['Report to this end date'] }}\nPrevious Period {date_range_1}- {{ $('Code').first().json['Previous start date'] }} to {{ $('Code').first().json['Previous end date'] }}\nMetrics:\n\nForm Submits Last Period – {form_submits_0}\n\nForm Submits Previous Period – {form_submits_1}\n\nMetrics Last Period – {metrics_0}\n\nMetrics Previous Period – {metrics_1}\n\nPercent-Change Rules:\n\nFor each metric (Sessions, Active Users, New Users, Page Views, etc.):\n\nCalculate % change = (last – previous) / previous × 100\n\nIf last > previous, prefix “+” and use color #10B981 (positive-change); if last < previous, prefix “–” and use color #EF4444 (negative-change).\n\nONLY FOR bounceRate is the following --> last > previous, prefix “+” and use color #EF4444 (negative-change)#10B981 (positive-change); if last < previous, prefix “–” and use color #10B981 (positive-change).\n\nAlways use the Think tool, to make sure all needed variables and the whole html is properly setup.\n\nFOR THE <!-- Summary Section --> {negative-change or positive-change COLORING ONLY NUMBERS/PERCENTAGES based on comparison, DO NOT COLOR ANY TEXT (IT SHOULD BE IN NORMAL TEXT COLOR)}\n\nFor every summary or recommendation you write, you need to be sure 100% that you have the information and to articulate it correctly. DO NOT HALLUCINATE ON WHAT YOU DO NOT HAVE AS INFORMATION. BE 100% SUR THAT IT IS CORRECT RECOMENDATION. \n\nHTML Structure:\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n <title>VertoDigital's monthly overview of your GA4 data</title>\n \n <style type=\"text/css\">\n #outlook a { padding: 0; }\n .ReadMsgBody { width: 100%; }\n .ExternalClass { width: 100%; }\n .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; }\n body, table, td, p, a, li, blockquote { -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }\n table, td { mso-table-lspace: 0pt; mso-table-rspace: 0pt; }\n img { -ms-interpolation-mode: bicubic; }\n \n body { margin: 0 !important; padding: 0 !important; }\n img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; }\n table { border-collapse: collapse !important; }\n body, #bodyTable, #bodyCell { height: 100% !important; margin: 0; padding: 0; width: 100% !important; }\n \n #bodyCell { padding: 20px; }\n #templateContainer { width: 800px; }\n \n .positive-change { color: #16a34a !important; }\n .negative-change { color: #dc2626 !important; }\n \n @media only screen and (max-width: 480px) {\n body, table, td, p, a, li, blockquote { -webkit-text-size-adjust: none !important; }\n body { width: 100% !important; min-width: 100% !important; }\n #bodyCell { padding: 10px !important; }\n #templateContainer { max-width: 800px !important; width: 100% !important; }\n .mcnTextContent { word-break: break-word; }\n .mobile-hide { display: none !important; }\n .mobile-center { text-align: center !important; }\n .mobile-stack { display: block !important; width: 100% !important; }\n }\n </style>\n</head>\n<body leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\" offset=\"0\" style=\"height:100% !important;margin:0;padding:0;width:100% !important;background-color:#f9fafb;color:#111827;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:1.5;\">\n <center>\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"100%\" width=\"100%\" id=\"bodyTable\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;height:100% !important;margin:0;padding:0;width:100% !important;background-color:#f9fafb;\">\n <tr>\n <td align=\"center\" valign=\"top\" id=\"bodyCell\" style=\"height:100% !important;margin:0;padding:20px;width:100% !important;\">\n \n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"templateContainer\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;width:800px;background-color:#ffffff;\">\n \n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding-bottom:20px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <img src=\"https://drive.google.com/uc?export=view&id=1dcyTMtzdojG2nz2H8-vzd3NyZS0Q8l2u\" alt=\"VertoDigital Logo\" width=\"200\" height=\"auto\" style=\"max-width:200px;border:0;height:auto;line-height:100%;outline:none;text-decoration:none;display:block;\" />\n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n <tr>\n <td align=\"center\" valign=\"top\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;background-color:#3b82f6;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"padding:20px;color:#ffffff;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\">\n <h1 style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;line-height:125%;color:#ffffff;text-align:left;\">\n {{ $('Code').first().json['Client Name'] }} GA4 Analytics\n </h1>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#ffffff;text-align:left;margin-top:4px;margin-bottom:15px;\">\n Here are stats that capture how users interacted with {{ $('Code').first().json['Client Name'] }}. Explore trends, top performance metrics, and more.\n </p>\n \n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;margin-bottom:15px;\">\n <tr>\n <td align=\"left\" valign=\"middle\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:14px;padding:8px 16px;background-color:#ffffff;border-radius:4px;\">\n <a href=\"https://analytics.google.com/analytics/web/#/p{{ $node[\"Code\"].json[\"Account ID\"] }}/reports/explorer?params=_u..nav%3Dmaui%26_u.date00%3D{{ $json['Report from start date'] }}%26_u.date01%3D{{ $json['Report to this end date'] }}%26_u.date10%3D{{ $json['Previous start date'] }}%26_u.date11%3D{{ $json['Previous end date'] }}&ruid=lifecycle-traffic-acquisition-v2,life-cycle,acquisition&collectionId=8273756469&r=lifecycle-traffic-acquisition-v2\" target=\"_blank\" style=\"color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:14px;font-weight:bold;text-decoration:none;display:block;\">\n View in Google Analytics\n </a>\n </td>\n </tr>\n </table>\n \n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;line-height:125%;color:#ffffff;text-align:left;\">\n {{ $node[\"Code\"].json[\"Report from start date\"] }} – {{ $node[\"Code\"].json[\"Report to this end date\"] }} vs. {{ $node[\"Code\"].json[\"Previous start date\"] }} - {{ $node[\"Code\"].json[\"Previous end date\"] }}\n </p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n <!-- BEGIN SUMMARY -->\n <tr>\n <td align=\"center\" valign=\"top\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"padding:20px;\">\n <h2 style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;line-height:125%;color:#111827;text-align:left;margin-bottom:10px;\">\n User and traffic metrics for {{ $('Code').first().json['Client Name'] }}\n </h2>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:left;margin-bottom:10px;\">\n Change from {{ $node[\"Code\"].json[\"Report from start date\"] }} to {{ $node[\"Code\"].json[\"Report to this end date\"] }} compared to previous period from {{ $('Code').first().json['Previous start date'] }} to {{ $('Code').first().json['Previous end date'] }}\n </p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#374151;text-align:left;margin-bottom:10px;\">\n {Generate dynamic summary paragraph 1 based on:\n - Current period data: {{ JSON.stringify($('Overall Metrics This Period').first().json) }}\n - Previous period data: {{ JSON.stringify($('Overall Metrics Previous Period').first().json) }}\n - Current conversions: {{ JSON.stringify($('Form Submits This Period').first().json) }}\n - Previous conversions: {{ JSON.stringify($('Form Submits Previous Period').first().json) }}\n \n Instructions for AI/Calculator:\n 1. Calculate percentage changes for each metric\n 2. Focus on traffic metrics (sessions, users, new users) in this paragraph\n 3. Use positive language for increases, concern language for decreases\n 4. Wrap ONLY percentage numbers with appropriate span classes:\n - <span class=\"positive-change\">+X.XX%</span> for positive changes\n - <span class=\"negative-change\">-X.XX%</span> for negative changes\n 5. Keep all descriptive text in normal color\n 6. Example format: \"<span class=\"positive-change\">+15.12%</span> sessions, <span class=\"positive-change\">+18.51%</span> active users, and <span class=\"positive-change\">+20.97%</span> new users indicate positive traffic growth for {{ $('Code').first().json['Client Name'] }}.\"\n }\n </p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#374151;text-align:left;\">\n {Generate dynamic summary paragraph 2 based on:\n - Current period engagement data: {{ JSON.stringify($('Overall Metrics This Period').first().json) }}\n - Previous period engagement data: {{ JSON.stringify($('Overall Metrics Previous Period').first().json) }}\n - Current conversions: {{ JSON.stringify($('Form Submits This Period').first().json) }}\n - Previous conversions: {{ JSON.stringify($('Form Submits Previous Period').first().json) }}\n \n Instructions for AI/Calculator:\n 1. Calculate percentage changes for engagement and conversion metrics\n 2. Focus on engagement metrics (bounce rate, session duration, views per session) and conversion metrics\n 3. Identify areas of concern or improvement\n 4. Wrap ONLY percentage numbers with appropriate span classes:\n - <span class=\"positive-change\">+X.XX%</span> for improvements (note: for bounce rate, + is negative, - is positive)\n - <span class=\"negative-change\">-X.XX%</span> for declines\n 5. Keep all descriptive text in normal color\n 6. Provide actionable insights or concerns\n 7. Example format: \"However, <span class=\"negative-change\">-6.87%</span> views per session and <span class=\"negative-change\">-7.20%</span> average session duration suggest slightly decreased engagement per visit. Form submissions are down by <span class=\"negative-change\">-14.94%</span>, indicating potential issues in the conversion process.\"\n }\n </p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n <!-- // END SUMMARY -->\n \n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding:0 15px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"background-color:#dbeafe;color:#1e40af;padding:10px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;border-left:4px solid #2563eb;\">\n Traffic Metrics\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding-top:10px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Sessions</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[0].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Engaged Sessions</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[1].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">New Users</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[6].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Active Users</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[7].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding:0 15px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"background-color:#ede9fe;color:#5b21b6;padding:10px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;border-left:4px solid #7c3aed;\">\n Engagement Metrics\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding-top:10px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Average Session Duration</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[2].value }} {in minutes and seconds for example Xm Xs}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Bounce Rate</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[3].value }}%{if it is 0.XX%, it should be XX.XX% so it should be multipled by 100}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change when + or positive-change when - based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Views Per Session</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[4].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"25%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Events Per Session</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Overall Metrics This Period').first().json.rows[0].metricValues[5].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding:0 15px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"background-color:#fef3c7;color:#92400e;padding:10px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;border-left:4px solid #d97706;\">\n Conversion Metrics\n </td>\n </tr>\n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding-top:10px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\" width=\"50%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Conversions ({{ $('Code').first().json['Key Event'] }})</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{{ $('Form Submits This Period').first().json.rows[0].metricValues[0].value }}</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n <td align=\"center\" valign=\"top\" width=\"50%\" style=\"padding:10px;border:1px solid #e5e7eb;background-color:#ffffff;\" class=\"mobile-stack\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;margin-bottom:5px;\">Conversion Rate ({{ $('Code').first().json['Key Event'] }})</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;line-height:125%;color:#111827;text-align:center;\">{calculate based on {{ $('Form Submits This Period').first().json.rows[0].metricValues[0].value }} devided by {{ $('Overall Metrics This Period').first().json.rows[0].metricValues[0].value }} in percentages with 2 decimals after comma} %</p>\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:{negative-change or positive-change based on comparison};text-align:center;margin-top:5px;\">{+/- change in %}</p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding:0 15px 30px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\">\n <h2 style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;line-height:125%;color:#111827;text-align:left;margin:30px 0 15px;\">Recommended Actions</h2>\n \n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;margin-bottom:20px;border:1px solid #e5e7eb;background-color:#ffffff;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"background-color:#dbeafe;color:#1e40af;padding:10px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;\">\n Website Engagement Recommendations\n </td>\n </tr>\n <tr>\n <td align=\"left\" valign=\"top\" style=\"padding:15px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" width=\"20\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#2563eb;padding-right:10px;\">•</td>\n <td align=\"left\" valign=\"top\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#374151;\">\n {Website Engagement Recommendation for example (only for reference):Consider optimizing the form submission process as the decreased conversion rate despite increased engagement suggests friction points in the conversion funnel. or Review mobile page performance and consider further optimizations, as mobile sessions are showing the strongest growth. or Analyze the top-performing content that's driving the increased session duration and create similar content to capitalize on this engagement trend or something similar}\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n \n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;margin-bottom:20px;border:1px solid #e5e7eb;background-color:#ffffff;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"background-color:#ede9fe;color:#5b21b6;padding:10px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;\">\n Traffic Optimization Recommendations\n </td>\n </tr>\n <tr>\n <td align=\"left\" valign=\"top\" style=\"padding:15px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" width=\"20\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#7c3aed;padding-right:10px;\">•</td>\n <td align=\"left\" valign=\"top\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#374151;\">\n {Traffic Recommendation for example (only for reference):Invest more resources in organic search optimization, as this channel is driving significant new user acquisition. or Develop targeted campaigns to re-engage desktop users, as this segment shows minimal growth compared to mobile users. or Consider implementing audience segmentation to better understand the behavior differences between new and returning users. or something similar}\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n \n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;border:1px solid #e5e7eb;background-color:#ffffff;\">\n <tr>\n <td align=\"left\" valign=\"top\" style=\"background-color:#fef3c7;color:#92400e;padding:10px;font-family:Arial, Helvetica, sans-serif;font-size:16px;font-weight:bold;\">\n Conversion Improvement Recommendations\n </td>\n </tr>\n <tr>\n <td align=\"left\" valign=\"top\" style=\"padding:15px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"left\" valign=\"top\" width=\"20\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:bold;color:#d97706;padding-right:10px;\">•</td>\n <td align=\"left\" valign=\"top\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#374151;\">\n {Conversion Recommendation for example (only for reference): Conduct user testing on the form submission process to identify and address potential usability issues. or Implement A/B testing on form layouts and call-to-action messaging to improve conversion rates. or Review the user journey leading to form submissions and identify potential drop-off points that may be contributed to the decreased conversion rate. or something similar}\n </td>\n </tr>\n </table>\n </td>\n </tr>\n </table>\n \n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n <tr>\n <td align=\"center\" valign=\"top\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;\">\n <tr>\n <td align=\"center\" valign=\"top\" style=\"padding:30px;\">\n <p style=\"margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:150%;color:#6b7280;text-align:center;\">\n If you have any questions or need help – feel free to reach out to <a href=\"mailto:analytics@vertodigital.com\" style=\"color:#2563eb;text-decoration:none;\">analytics@vertodigital.com</a>\n </p>\n </td>\n </tr>\n </table>\n </td>\n </tr>\n \n </table>\n \n </td>\n </tr>\n </table>\n </center>\n</body>\n</html>\n\n\n\n\nRules:\n- For every summary or recommendation you write, you need to be sure 100% that you have the information and to articulate it correctly. DO NOT HALLUCINATE ON WHAT YOU DO NOT HAVE AS INFORMATION. BE 100% SUR THAT IT IS CORRECT RECOMENDATION. \n- Always use Think tool to rethink the information and to make sure the html is 100% correct\n- Always use Calculator tool when there is something to be compared or calculated\n- Where is a percentage change always use positive-change or negative-change colors - If last > previous, prefix “+” and use color #10B981; if last < previous, prefix “–” and use color #EF4444.\n- Data Ranges - make them in format dd mm yyyy where mm should be first 3 letters from mm for example Mar or Apr\n\n\nCHECK IS IT VALID HTML and output the whole correct HTML without changing any information in the html. \nTHE OUTPUT SHOULD BE ONLY:\n<!DOCTYPE html> <html lang=\"en\">{Correct output}</html>\n\nCHECK IS IT VALID HTML and output the whole correct HTML without changing any information in the html.\nTHE OUTPUT SHOULD BE ONLY:\n<!DOCTYPE html> <html lang=\"en\">{Correct output}</html>",
"options": {
"maxIterations": 50
},
"promptType": "define"
},
"retryOnFail": true,
"typeVersion": 1.8
},
{
"id": "068c440e-6ece-4006-9636-f5e73d67856f",
"name": "Overall Metrics This Period",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1056,
-32
],
"parameters": {
"url": "=https://analyticsdata.googleapis.com/v1beta/properties/{{ $('Get Client').item.json[\"Account ID\"] }}:runReport",
"method": "POST",
"options": {},
"jsonBody": "={\n \"dateRanges\": [\n { \"startDate\": \"{{ $('Get Client').item.json['Report from start date'] }}\", \"endDate\": \"{{ $('Get Client').item.json['Report to this end date'] }}\" }\n ],\n \"metrics\": [\n { \"name\": \"sessions\" },\n { \"name\": \"engagedSessions\" },\n { \"name\": \"averageSessionDuration\" },\n { \"name\": \"bounceRate\" },\n { \"name\": \"screenPageViewsPerSession\" },\n { \"name\": \"eventsPerSession\" },\n { \"name\": \"newUsers\" },\n { \"name\": \"activeUsers\" },\n { \"name\": \"sessionKeyEventRate:{{ $json[\"Key Event\"] }}\" }\n ],\n \"dimensions\": []\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "googleAnalyticsOAuth2"
},
"credentials": {
"googleAnalyticsOAuth2": {
"id": "3NaRZW1ulEYDdGah",
"name": "Google Analytics account"
}
},
"typeVersion": 4.2
},
{
"id": "254c5df0-003c-40ea-9eb9-fc8b2b2b8150",
"name": "Overall Metrics Previous Period",
"type": "n8n-nodes-base.httpRequest",
"position": [
-848,
-32
],
"parameters": {
"url": "=https://analyticsdata.googleapis.com/v1beta/properties/{{ $('Get Client').item.json[\"Account ID\"] }}:runReport",
"method": "POST",
"options": {},
"jsonBody": "={\n \"dateRanges\": [\n { \"startDate\": \"{{ $('Get Client').item.json['Previous start date'] }}\", \"endDate\": \"{{ $('Get Client').item.json['Previous end date'] }}\" }\n ],\n \"metrics\": [\n { \"name\": \"sessions\" },\n { \"name\": \"engagedSessions\" },\n { \"name\": \"averageSessionDuration\" },\n { \"name\": \"bounceRate\" },\n { \"name\": \"screenPageViewsPerSession\" },\n { \"name\": \"eventsPerSession\" },\n { \"name\": \"newUsers\" },\n { \"name\": \"activeUsers\" },\n { \"name\": \"sessionKeyEventRate:{{ $('Get Client').item.json['Key Event'] }}\" }\n ],\n \"dimensions\": []\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "googleAnalyticsOAuth2"
},
"credentials": {
"googleAnalyticsOAuth2": {
"id": "3NaRZW1ulEYDdGah",
"name": "Google Analytics account"
}
},
"typeVersion": 4.2
},
{
"id": "985f5f91-31a2-48a3-9f36-dbd2c94126e2",
"name": "Form Submits This Period",
"type": "n8n-nodes-base.httpRequest",
"position": [
-640,
-32
],
"parameters": {
"url": "=https://analyticsdata.googleapis.com/v1beta/properties/{{ $('Get Client').item.json['Account ID'] }}:runReport",
"method": "POST",
"options": {},
"jsonBody": "={\n \"dateRanges\": [\n { \"startDate\": \"{{ $('Get Client').item.json['Report from start date'] }}\", \"endDate\": \"{{ $('Get Client').item.json['Report to this end date'] }}\" }\n ],\n \"metrics\": [\n { \"name\": \"eventCount\" }\n ],\n \"dimensions\": [],\n \"dimensionFilter\": {\n \"filter\": {\n \"fieldName\": \"eventName\",\n \"stringFilter\": {\n \"value\": \"{{ $('Get Client').item.json['Key Event'] }}\",\n \"matchType\": \"EXACT\",\n \"caseSensitive\": false\n }\n }\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "googleAnalyticsOAuth2"
},
"credentials": {
"googleAnalyticsOAuth2": {
"id": "3NaRZW1ulEYDdGah",
"name": "Google Analytics account"
}
},
"typeVersion": 4.2
},
{
"id": "c229f0d3-34a2-4d96-9701-61500e567b60",
"name": "Form Submits Previous Period",
"type": "n8n-nodes-base.httpRequest",
"position": [
-416,
-32
],
"parameters": {
"url": "=https://analyticsdata.googleapis.com/v1beta/properties/{{ $('Get Client').item.json['Account ID'] }}:runReport",
"method": "POST",
"options": {},
"jsonBody": "={\n \"dateRanges\": [\n { \"startDate\": \"{{ $('Get Client').item.json['Previous start date'] }}\", \"endDate\": \"{{ $('Get Client').item.json['Previous end date'] }}\" }\n ],\n \"metrics\": [\n { \"name\": \"eventCount\" }\n ],\n \"dimensions\": [],\n \"dimensionFilter\": {\n \"filter\": {\n \"fieldName\": \"eventName\",\n \"stringFilter\": {\n \"value\": \"{{ $('Get Client').item.json['Key Event'] }}\",\n \"matchType\": \"EXACT\",\n \"caseSensitive\": false\n }\n }\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "googleAnalyticsOAuth2"
},
"credentials": {
"googleAnalyticsOAuth2": {
"id": "3NaRZW1ulEYDdGah",
"name": "Google Analytics account"
}
},
"typeVersion": 4.2
},
{
"id": "2bc69249-9abf-4324-aa7e-698c05e0905b",
"name": "Think",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
320,
192
],
"parameters": {},
"typeVersion": 1
},
{
"id": "083b74ac-80e0-46d1-b912-6c9cd74b3459",
"name": "Get Client",
"type": "n8n-nodes-base.formTrigger",
"position": [
-1264,
-32
],
"webhookId": "d268a49e-6a54-489b-aeaa-4b80eebeb333",
"parameters": {
"options": {},
"formTitle": "Google Analytics Reporting",
"formFields": {
"values": [
{
"html": "<!-- Your custom HTML here --->\n<p style=\"text-align:left; margin:0 0 18px 0;\"> Enter your GA4 property details and date ranges to generate a comprehensive monthly analytics report. The system will automatically pull your website data, analyze performance trends, and send you a professional HTML email report with insights and recommendations. </p> <p style=\"text-align:left; margin:0 0 12px 0;\"> Here is how the workflow works: </p> <ol style=\"text-align:left; margin:0; padding-left:20px;\"> <li style=\"text-align:left; margin:0 0 12px 0;\">Fill out form with GA4 Account ID, key event, date ranges, and email details.</li> <li style=\"text-align:left; margin:0 0 12px 0;\">Pull current period metrics from Google Analytics API.</li> <li style=\"text-align:left; margin:0 0 12px 0;\">Pull previous period metrics for comparison analysis.</li> <li style=\"text-align:left; margin:0 0 12px 0;\">AI Agent analyzes data and calculates percentage changes with insights.</li> <li style=\"text-align:left; margin:0 0 12px 0;\">Generate professional HTML email report with recommendations.</li> <li style=\"text-align:left; margin:0;\">Automatically send formatted report to the specified email address.</li>\n\n",
"fieldType": "html"
},
{
"fieldLabel": "Account ID",
"placeholder": "123123123",
"requiredField": true
},
{
"fieldLabel": "Key Event",
"placeholder": "form_submit",
"requiredField": true
},
{
"fieldType": "date",
"fieldLabel": "Report from start date",
"requiredField": true
},
{
"fieldType": "date",
"fieldLabel": "Report to this end date",
"requiredField": true
},
{
"fieldType": "date",
"fieldLabel": "Previous start date",
"requiredField": true
},
{
"fieldType": "date",
"fieldLabel": "Previous end date",
"requiredField": true
},
{
"fieldLabel": "Client Name",
"placeholder": "VertoDigital",
"requiredField": true
},
{
"fieldType": "email",
"fieldLabel": "Send to email:",
"placeholder": "your-email@example.com",
"requiredField": true
}
]
}
},
"typeVersion": 2.2
},
{
"id": "01b643bc-11f8-40d4-a444-0168db895d90",
"name": "Send a message",
"type": "n8n-nodes-base.gmail",
"position": [
400,
-32
],
"webhookId": "b705886b-a0f7-4f9c-a387-de3396c1d236",
"parameters": {
"sendTo": "={{ $('Get Client').item.json['Send to email:']}}",
"message": "={{ $json.output }}",
"options": {
"appendAttribution": false
},
"subject": "={{ $('Get Client').item.json[\"Client Name\"] }} GA4 {{ $('Get Client').item.json[\"Report from start date\"].toDateTime().monthLong }} Report"
},
"credentials": {
"gmailOAuth2": {
"id": "7p0Ucz1B2x4YQC0T",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "18aab012-7844-4c58-b6f4-08be681762cd",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
-192,
-32
],
"parameters": {
"jsCode": "// 1. Pull in the form data\nconst form = $('Get Client').first().json;\n\n// 2. List the four fields you want to convert\nconst fields = [\n \"Report from start date\",\n \"Report to this end date\",\n \"Previous start date\",\n \"Previous end date\"\n];\n\n// 3. Loop over each field and remove hyphens\nfields.forEach(field => {\n const val = form[field];\n if (val && typeof val === 'string') {\n form[field] = val.replace(/-/g, '');\n }\n});\n\n// 4. Return one item containing your reformatted dates\nreturn [\n {\n json: form\n }\n];"
},
"typeVersion": 2
},
{
"id": "83cb35ec-5f01-44ac-b10c-842176f2882b",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
-1040
],
"parameters": {
"width": 1024,
"height": 848,
"content": "## 🟨 Overview — Create GA4 HTML report and email via Gmail\n\n## Who’s it for\nMarketing, growth, and analytics teams who want a **decision-ready GA4 summary**—automatically calculated, clearly color-coded, and emailed as a polished HTML report.\n\n## How it works / What it does\n- **Get Client (Form Trigger)** collects **GA4 Property ID (“Account ID”)**, **Key Event**, **date ranges (current & previous)**, **Client Name**, and **recipient email**.\n- **Overall Metrics This Period / Previous Period (GA4 Data API)** pull sessions, users, engagement, bounce rate, and more for each range.\n- **Form Submits This Period / Previous Period (GA4 Data API)** fetch key-event counts for conversion comparisons.\n- **Code** normalizes form dates for API requests.\n- **AI Agent** builds a **valid HTML email**: \n - Calculates % deltas, applies **green for positive** (`#10B981`) and **red for negative** (`#EF4444`) changes.\n - Writes summary and recommendations.\n - Produces the **final HTML only**.\n- **Send a message (Gmail)** sends the formatted HTML report to the specified email address with a contextual subject.\n\n## How to set up\n1) Add credentials: **Google Analytics OAuth2**, **OpenAI** (Chat), **Gmail OAuth2**. \n2) Ensure the form fields match your GA4 property and event names; **“Account ID” = GA4 Property ID**. \nProperty ID - https://take.ms/vO2MG\nKey event - https://take.ms/hxwQi\n3) Publish the form URL and run a test submission.\n\n## Requirements\nGA4 property access (Viewer/Analyst) • OpenAI API key • Gmail account with send permission.\n\n## Resources\nGoogle OAuth2 (GA4) – https://docs.n8n.io/integrations/builtin/credentials/google/oauth-generic/ \nOpenAI credentials – https://docs.n8n.io/integrations/builtin/credentials/openai/ \nGmail OAuth2 – https://docs.n8n.io/integrations/builtin/credentials/google/ \nGA4 Data API overview – https://developers.google.com/analytics/devguides/reporting/data/v1\n"
},
"typeVersion": 1
},
{
"id": "b76538a7-05e8-425b-a021-3253eff8bf0c",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1904,
-160
],
"parameters": {
"width": 560,
"height": 352,
"content": "## 🗒️ Setup checklist (do these before first run)\n\n- **Get Client (Form Trigger)** \n - Collect: *Account ID (GA4 Property ID), Key Event, Report date range (current & previous), Client Name, Send-to email*. \n - Tip: Find **Property ID** (guide: https://take.ms/vO2MG) and confirm **Key event** name (guide: https://take.ms/hxwQi).\n- **Overall Metrics This Period / Previous Period (GA4 Data API)** and **Form Submits This Period / Previous Period (GA4 Data API)** - attach **Google Analytics OAuth2** credential. \n- **OpenAI Chat Model**: attach your OpenAI credential. \n- **Send a message (Gmail)** - attach **Gmail OAuth2** credential. \n- Test with a known **GA4 Property ID (“Account ID”)**, **Key Event**, **date ranges (current & previous)**, **Client Name**, and **recipient email**\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "37ffddb4-807d-4453-a689-251862e1e8f4",
"connections": {
"18aab012-7844-4c58-b6f4-08be681762cd": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"2bc69249-9abf-4324-aa7e-698c05e0905b": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "01b643bc-11f8-40d4-a444-0168db895d90",
"type": "main",
"index": 0
}
]
]
},
"Calculator": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"083b74ac-80e0-46d1-b912-6c9cd74b3459": {
"main": [
[
{
"node": "068c440e-6ece-4006-9636-f5e73d67856f",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"985f5f91-31a2-48a3-9f36-dbd2c94126e2": {
"main": [
[
{
"node": "c229f0d3-34a2-4d96-9701-61500e567b60",
"type": "main",
"index": 0
}
]
]
},
"068c440e-6ece-4006-9636-f5e73d67856f": {
"main": [
[
{
"node": "254c5df0-003c-40ea-9eb9-fc8b2b2b8150",
"type": "main",
"index": 0
}
]
]
},
"c229f0d3-34a2-4d96-9701-61500e567b60": {
"main": [
[
{
"node": "18aab012-7844-4c58-b6f4-08be681762cd",
"type": "main",
"index": 0
}
]
]
},
"254c5df0-003c-40ea-9eb9-fc8b2b2b8150": {
"main": [
[
{
"node": "985f5f91-31a2-48a3-9f36-dbd2c94126e2",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Intermédiaire - Divers, Résumé IA, IA Multimodale
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Simeon Penev
@monkatagptI specialize in building AI workflows that streamline processes and reduce manual work. My main workflows are in the marketing field, but I can automate all kind of processes and integrate AI in them.
Partager ce workflow