> ## Documentation Index
> Fetch the complete documentation index at: https://docs.younegotiate.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Campaign Tracker

> EcoMail Hub users track sent, delivered, and viewed campaign results.

## Real-World Example

After Maya sends a pending-member campaign, she opens Email Campaign Tracker. The tracker shows how many creditor profiles were targeted, how many messages were sent, delivered, and viewed, and lets her export the creditor profiles attached to that campaign run.

Because SendGrid callbacks can arrive after the original job finishes, Maya can refresh the tracker to update the latest counts.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["Campaign delivery creates tracker"] --> B["Email recipients receive provider tracking keys"]
    B --> C["SendGrid reports sent, delivered, and viewed events"]
    C --> D["Tracker counts update"]
    D --> E{"User refreshes or exports?"}
    E -->|Refresh| F["Recalculate tracker snapshot"]
    E -->|Export| G["Download creditor profile CSV"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A,B,C,D system;
    class E decision;
    class F,G outcome;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## How It Should Work

* It should show campaign runs only for the logged-in EcoMail Hub user.
* It should track sent, delivered, and viewed counts from provider callbacks.
* It should allow exporting creditor profiles for a campaign run.
* It should allow refreshing the tracker snapshot when provider events arrived later.

## How It Should Not Work

* It should not expose another user's campaign tracking data.
* It should not mark emails delivered just because the app queued a send.
* It should not export a campaign with no creditor profiles attached.

## Developer Notes

* SendGrid callbacks update EcoMail Hub tracking when the payload scope is `ecomailhub`.
* Tracking counts can be refreshed from recipient timestamp rows.
* This page is connected to the shared communication/webhook behavior documented in [Communication Delivery & Webhooks](/portals/creditor/background-processing/communication-delivery-and-webhooks).

## Related App Areas

* `app/Livewire/ConsumerResponseManager/Communications/CampaignTracker/ListPage.php`
* `app/Services/EcoMailHubCampaignTrackerService.php`
* `app/Services/EcoMailHubCampaignRecipientTrackingService.php`
* `app/Http/Controllers/Webhooks/SendGridEmailWebhookController.php`
* `app/Exports/ConsumerResponseManager/CampaignCreditorProfilesExport.php`
