# Subscription Events Table

One-Click Unsubscribe automatically records all unsubscribe events in a dedicated table within your email domain's database. This table allows you to track unsubscribe activity, analyze trends, and build workflows to exclude unsubscribed users from future campaigns.

## Database and Table Location

Your subscription event data is stored in your Treasure account in the following location:

- **Database**: `delivery_email_{your-domain}` (e.g., `delivery_email_example_com`)
- **Table**: `subscription_events`


The `subscription_events` table is automatically created in the same database as your email delivery events when you enable TD Managed Unsubscribe.

## Event Schema

The `subscription_events` table contains the following fields:

| Field | Type | Description |
|  --- | --- | --- |
| `profile_identifier_value` | string | The recipient's email address |
| `profile_identifier_name` | string | Always "email_address" (for future multi-channel support) |
| `campaign_id` | string | Unique ID of the campaign |
| `campaign_name` | string | Name of the campaign |
| `group_id` | string | ID of the subscription group (currently always NULL for global unsubscribe) |
| `group_name` | string | Name of the subscription group (currently always "Global") |
| `action` | string | Currently always "opt-out" (opt-in functionality will be available in a future release) |
| `action_source` | string | How the unsubscribe was triggered: "post" (HTTPS) or "mailto" (email) |
| `channel` | string | Currently always "email" (SMS and push channel support will be available in future releases) |
| `task_id` | string | Unique identifier for the email sent |
| `user_agent` | string | Browser/device information (HTTPS only) |
| `ip_address` | string | IP address of the user (HTTPS only) |
| `sender` | string | Email address of the sender |
| `received_time` | timestamp | When TD received the unsubscribe request |
| `time` | timestamp | Automatically added by Plazma |


## Integration with Audience Studio

To use unsubscribe data in your campaigns, you need to integrate it as Attribute properties in your Parent Segment:

1. Create a table of unsubscribed users from the `subscription_events` table
2. Create an Attribute table with the opt-out flag
3. Register this table as an Attribute table in your Parent Segment
4. Use the Attribute in Audience Studio to filter out unsubscribed users when creating campaign audiences



```sql
-- Create a table of unsubscribed users
CREATE TABLE unsubscribed_users AS
SELECT
email, latest_action, last_updated, cast(1 as bigint) is_opt_out
FROM (
  SELECT
    profile_identifier_value AS email,
    MAX_BY(action, received_time) AS latest_action,
    MAX(received_time) AS last_updated
  FROM subscription_events
  WHERE group_name = 'Global'
  GROUP BY profile_identifier_value
  HAVING MAX_BY(action, received_time) = 'opt-out'
) t1
```

## Custom Non-PII Identifier Columns with the `td_log_` Prefix

For strict security environments that prohibit storing raw email addresses in unsubscribe logs, the `subscription_events` table supports custom, non-PII identifier columns via the `td_log_` prefix. When an activation defines output mappings whose destination column names start with `td_log_` (for example, `td_log_member_id`), those columns are automatically added to the `subscription_events` table and populated for each unsubscribe event generated by that activation.

This enables unsubscribe management and analysis using non-PII identifiers — such as internal member IDs, CRM IDs, or hashed identifiers — instead of (or alongside) raw email addresses. The same `td_log_*` column values also appear in the `events` and `error_events` tables, so you can correlate unsubscribes with deliveries, bounces, and errors without joining on email addresses.

For setup instructions, limits (maximum of 5 `td_log_*` fields per activation, ASCII-only column names, 256-character column-name limit), and guidance on not mapping PII into `td_log_*` fields, see [Email Delivery Events Table](/products/marketing-cloud/engage-studio/channels/email/email-delivery-events-table).

## Related Documentation

- [One-Click Unsubscribe Management](/products/marketing-cloud/engage-studio/channels/email/one-click-unsubscribe)
- [Email Delivery Events Table](/products/marketing-cloud/engage-studio/channels/email/email-delivery-events-table)
- [Email Sender Configuration](/products/marketing-cloud/engage-studio/channels/email/email-sender-configuration)