Skip to content

Design email template sections (1/2) #11550

@benbowler

Description

@benbowler

Feature Description

  • Implement a set of the email template module sections
  • Test the sections on mobile, web and desktop email clients

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Renders additional modular sections (Figma designs) for the email-report template key using mock data only; no live data or scheduler logic in this issue:
    • How many people are finding and visiting my site?
    • How are people finding me?
  • Rendered via the reusable Email class as implemented in Create a reusable Email class #11564.
  • Utilises the keyed folder structure, extending the base template in Create email report base template #11549, within the parts folder.
  • Sections are conditionally included if the data for that section is provided. No module access logic should be included in the template.
    • If a section’s data array is absent/empty (e.g., module not shared/available in user context), the section is omitted without leaving visual gaps or broken spacers.
    • Sections which share designs should share template parts.
  • Formatting helpers should be created to ensure:
    • Numeric formatting: thousands/millions abbreviations with up to 2 decimal places where relevant; negative deltas include a minus sign.
    • Titles/labels truncated to preserve layout (overflow ellipsis may not be supported, so direct cutoff may be needed); long domains are non-overflowing.
    • All output escaped at echo time using appropriate esc_* functions; allow only known-safe HTML via minimal wp_kses when required.
  • For development, assets can be loaded locally; they will later move to cloud hosting with versioned URLs.
  • All strings translatable (text domain: google-site-kit) with translators' comments where context is helpful.
  • Basic dark-mode friendly colours ensuring contrast in common clients that auto-invert (can be tested using Email on Acid).

Implementation Brief

  • Create includes/Core/Util/Email_Reporting/templates/email-report/parts/section-part-metrics.php and includes/Core/Util/Email_Reporting/templates/email-report/parts/section-part-page-metrics.php: Implement the Figma mocks for sections: How many people are finding and visiting my site? and How are people finding me? block with titles, metrics with inline styles. Section icon image via plugin_url with explicit alt/width/height. Dashboard CTA link linking to relevant dashboard link. Dashboard link and change badge used for % change, using existing reusable parts (added in Create email report base template #11549):
    • includes/Core/Util/Email_Reporting/templates/email-report/parts/section-header.php
    • includes/Core/Util/Email_Reporting/templates/email-report/parts/change-badge.php
    • includes/Core/Util/Email_Reporting/templates/email-report/parts/dashboard-link.php

Test Coverage

  • No new test coverage required.

QA Brief

  • Get the pre-release version of the tester plugin from @benbowler.
  • From the new Email Reporting tab, open the email template preview by clicking the "Launch Report Preview" button:
  • Image
  • Review the template in the browser, comparing it to the Figma designs. It should not be pixel-perfect, but obvious differences should be raised and discussed. Notes:
    • Fonts won't match the design as they will instead use the approved font stack: "Google Sans", Roboto, Arial, sans-serif.
    • A gap has been left in the designs for the "Detected.." badge, which will be added in v1.
    • Image
    • All links and data are mock links and data, so no need to test for this ticket.
  • Right click and click "View page source" - copy the HTML into Email on Acid and review each client. Again, this should not be pixel-perfect, but obviously broken emails should be flagged.
  • Dark mode changes should be added to Update email-report template to support dark mode #11833 to be addressed later.

Changelog entry

  • Add email reporting templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0High priorityTeam SIssues for Squad 1Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions