Skip to content

Add support for in email notices - Enable Conversion events (views within a section) #11844

@benbowler

Description

@benbowler

Feature Description

Update the email reporting infrastructure to support in email report notices. The initial notices will be:

  • Analytics set up (views at the top of the template)
  • Enable Conversion events (views within a section) this ticket

Email notices should be flexible for future registered notifications.
Notices should be dismissed if clicked or after being included in two email reports.


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

Acceptance criteria

  • Email reports support section-level notices registered via the notice infrastructure implemented in Add support for in email notices - Analytics set up (views at the top of the template) #11843; notices can target specific sections and render inline within that section.
  • The "Enable conversion events" notice (Figma design) renders inside the conversions section when plugin conversion tracking events are not enabled for the recipient's site/user context (and Analytics module is shared with/user has access to).
  • The notice CTA routes through the email link proxy, dismisses the notice for the user, and redirects to the dashboard location to enable conversion events (Analytics module edit settings screen where conversion toggle is located).
  • Notices are suppressed once dismissed and are automatically dismissed after they have appeared in two sent reports for that user.
  • If conversion events are already enabled or the user cannot act, the notice does not render and the rest of the section remains unchanged.
  • *Show notice when conversion tracking is disabled and any of the supported plugins is detected

Implementation Brief

  • Add section placement support to the email notice registry/resolver (includes/Core/Email_Reporting/Email_Notices.php):
    • Extend the notice schema to accept placement (header/section) plus section_key, update the resolver to filter by placement, and add get_section_notices( WP_User $user, string $section_key ) that returns only notices whose should_display passes and whose section_key matches the requested section.
    • Use the dismissal/impression tracking from Add support for in email notices - Analytics set up (views at the top of the template) #11843’s Email_Notices implementation (Dismissed_Prompts + count/expiry); this issue should only consume that API for the section notice and must not add new storage or duplicate logic.
    • Register the conversions notice in the Email_Notices definitions list: add a new notice config entry (alongside the existing header notices from Add support for in email notices - Analytics set up (views at the top of the template) #11843) with placement: section and section_key: is_my_site_helping_my_business_grow. The should_display( WP_User $user ) callback should:
      • Confirm Analytics is available to the user (admin or shared access) and
      • Conversions are not enabled;
    • The get_payload() callback returns the localized title/body/CTA label plus the CTA URL built via the email link proxy (include the notice ID so the proxy can dismiss on click).
    • Build the CTA URL through the email link proxy introduced in Implement Golinks concept for generalisable redirects to SK screens #11849, include notice_id for click-based dismissal, and target the Analytics settings view where the conversions toggle lives.
  • in Email_Template_Formatter::build_template_payload()
    • Resolve section notices via the new Email_Notices::get_section_notices( $user, $section_key ) and include the results under a new template_data['section_notices'] map keyed by section key.
    • Then in section-conversions.php, read section_notices['is_my_site_helping_my_business_grow'] (if present) and render the notice at the top of the section body. If no notice exists for that key, the template stays unchanged. (Use a shared partial if one already exists for header notices, or add a small notice.php partial to keep markup consistent.)

Test Coverage

  • Add tests for notice eligibility (conversions off + user has Analytics access), suppression when dismissed or count >= 2, and CTA proxy URL includes notice_id.
  • Template rendering: conversions section includes the notice when eligible and remains unchanged otherwise.

QA Brief

  • Setup Site Kit with proactiveUserEngagement FF enabled
  • Subscribe to email reporting
  • Setup Analytics module and disable conversion tracking
  • Trigger email report:
    • Verify email notice is not showing
  • Install one of the supported plugins for conversion tracking (eq Contact Form 7, or Easy Digital Downloads, or WooCommerce, or WPForms)
  • Trigger email report:
    • Verify that notice is showing
  • Notice should be showing 2 times, and then on third email it should not appear, or if setup CTA is taken after first showing, it should not appear again

Changelog entry

  • Add support for conversion events in email reports.

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