google / google/site-kit-wp

Integrate and enable Site Goals sections at the top of the email report

Closed
#13,014 8 comments 0 reactions 0 assignees View on GitHub
P1 Team S Type: Enhancement
Dominant language
JavaScript
Stars
1.4k
Forks
383
Avg merge
4d 14h
Merged PRs (30d)
77

Description

## Feature Description

Bring the Site Goals feature into the email report. When Site Goals is set up and visible on the dashboard, the report shows two new cards at the very top: "How is my online store performing?" and "Are people reaching out to my business?", each summarising the site's primary conversion metric (rate + total) for the period against the previous one. When per-plugin or per-form breakdown data is available, each card lists results grouped per plugin (for example WooCommerce, Easy Digital Downloads) or per form, with an "Other sources" group where applicable; otherwise it shows aggregated figures with a prompt to enable data breakdown. Each card shows the primary conversion metrics (the rate and total), matching the email design. The cards respect existing Analytics sharing permissions.

Screenshot 2026-07-23 at 12.56.56.png

[Figma designs](https://www.figma.com/design/IsjMhBZHT5aMgBENleQoSQ/Proactive-user-engagement?node-id=4036-29485&t=b84D4yxFN95opzyb-0).

This is the integration ticket that adds the two sections into the report, adds the conditions for rendering them, and removes leftover conversion widget code. The data querying (#13167), adding data to views (#13168), and card templates (#13169) are delivered by three separate tickets that block it.

---------------

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

## Acceptance criteria

* When Site Goals is enabled and the dashboard shows the online store widget, the email report shows the "How is my online store performing?" card at the top.
* When Site Goals is enabled and the dashboard shows the lead widget, the email report shows the "Are people reaching out to my business?" card.
* Each card shows the primary metric rate and total for the period, with a trend versus the previous period.
* When breakdown data is available, each card lists results grouped per plugin (store) or per form (leads), with an "Other sources" group where applicable.
* When breakdown data is not available, each card shows aggregated figures and a prompt to enable data breakdown that links to the dashboard.
* View-only recipients see the cards only when Analytics is shared with their role, and recipients without Analytics access do not see them.
* The cards appear only when the Site Goals feature is enabled.

## Implementation Brief

Tickets #13167, #13168, and #13169 deliver the backend reports, the data to the frontend, and the card templates. This ticket places the two sections at the top of the report, adds the conditions that render the Site Goals content, and removes the dead conversion widget code.

### Files to modify

Backend

* [ ] Update `includes/Core/Email_Reporting/Sections_Map.php` to add the two Site Goals section descriptors (online store, lead generation) and prepend them in `get_sections()` so they render above `get_visitors_section()`, only when the `siteGoals` feature flag is enabled and the widget is visible (e-commerce or lead events detected and the corresponding provider plugin active, mirroring the dashboard `isSiteGoalWidgetActive` conditions).
* [ ] Update `includes/Core/Email_Reporting/Email_Assets.php` to remove the orphaned `icon-conversions`, `conversions-timeline-green`, and `conversions-timeline-red` entries left after the conversion widget removal.
* [ ] Update `includes/Core/Email_Reporting/Email_Notices.php` to remove the now-unused section-notice infrastructure (`get_section_notices`, `get_section_notice_keys`, `PLACEMENT_SECTION`), confirming no notice registers a section placement.

### Test Coverage

* Update `tests/phpunit/integration/Core/Email_Reporting/Sections_MapTest.php` to assert both Site Goals sections render at the top when enabled and eligible, and are absent when the flag is off or the widget conditions are unmet.
* Update `tests/phpunit/integration/Core/Email_Reporting/Email_Log_ProcessorTest.php` (or the equivalent pipeline test) to assert an eligible recipient's rendered report includes both cards, and a recipient without Analytics access does not.
* Verify both cards in aggregated and breakdown states across email clients via Email on Acid before launch.

## QA Brief

* Connect Analytics, and set up Site Goals so the dashboard shows the **Online store performance** and **Lead generation performance** widgets. Subscribe to the weekly email report.
* Send the weekly email report. Confirm that the email opens with the **How is my online store performing?** card, then the **Are people reaching out to my business?** card, as in the [Figma design](https://www.figma.com/design/IsjMhBZHT5aMgBENleQoSQ/Proactive-user-engagement?node-id=4036-29485). Some styles differ from the design, such as the border radius of the change badges. They're out of scope for this issue.
* With the data breakdown off, confirm that each card shows one rate and one total for the whole site. Confirm that each value shows its change against the previous period. Click **enable data breakdown** in each card's prompt, and confirm that the Site Kit dashboard opens.
* Turn the data breakdown on, then send the report again. Confirm that the online store card lists one group per plugin, and the lead generation card lists one group per form. Confirm that results with no plugin or form appear under **Other sources**.
* Open the plain text version of the same email. Confirm that it lists the same two cards first, with the same values.
* Share Analytics with the **Editor** role, subscribe an editor, and send the report. Confirm that the editor's email shows both cards. Stop sharing Analytics with the **Editor** role, send the report again, and confirm that the editor's email shows no Site Goals card.
* When the dashboard shows only one of the two Site Goals widgets, send the report. Confirm that the email shows only the matching card.
* When the dashboard shows neither Site Goals widget, send the report. Confirm that the email opens with **How many people are finding and visiting my site?**, with no Site Goals card.
* Disconnect Analytics, then send the report. Confirm that the email opens with the **Understand how visitors interact with your content** notice and its **Set up Analytics** button.
* **Note:** A card whose rate and total are both zero for the period stays out of the email.

## Changelog entry

* Add Site Goals sections at the top of the email report.

Contributor guide

Open the contributing guide

Research direction

Start with includes/Core/Email_Reporting/Sections_Map.php and review the existing section ordering and dashboard widget eligibility conditions. Then inspect Email_Assets.php, Email_Notices.php, Sections_MapTest.php, and Email_Log_ProcessorTest.php, along with the outputs from #13167–#13169. Done means eligible Site Goals cards appear first with correct access gating, while obsolete conversion assets and notice infrastructure are removed and the listed tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.