How Scrubbing Rules Work
How to configure rules that remove, replace, or hash sensitive data before forwarding events.
Scrubbing rules tell PixelsCleared how to handle specific fields in your event payloads before they reach destination platforms. Every event passes through the scrubbing engine, which applies your rules in priority order.
Rule Types
Each rule has an action that determines what happens to the matched field:
- Remove field -- Deletes the field entirely from the payload. The destination never sees it.
- Replace value -- Overwrites the field value with a static string you define. Useful for masking data while keeping the field present.
- Hash value -- Replaces the field value with a SHA-256 hash. The destination receives a hashed identifier instead of the original.
- Rename field -- Changes the field name while preserving the value. Useful for remapping to destination-specific field names.
Field Matching
Rules match against event payload fields by name:
- Exact match -- The field name in the rule must exactly match the key in the event payload (for example,
emailoruser_phone). - Dot notation -- Match nested fields using dot notation (for example,
user.emailorcontext.page.url). - Pattern match -- Use a wildcard pattern to match multiple fields (for example,
*_emailmatchesuser_email,contact_email, and so on).
When multiple rules match the same field, only the highest-priority rule is applied.
Priority Ordering
Rules are evaluated from lowest priority number to highest. Priority 1 runs first, priority 2 next, and so on. If two rules match the same field, the rule with the higher priority number wins.
For example, if you have:
- Priority 1: Hash all fields matching
*email* - Priority 5: Remove field
user.email
The user.email field would be removed (priority 5) rather than hashed (priority 1).
Enable and Disable Rules
Each rule has an Enabled toggle in the rules table:
- Enabled -- The rule is active and applied to all incoming events.
- Disabled -- The rule is skipped. The field passes through unchanged unless another rule matches it.
Disabling a rule is useful for testing changes or temporarily relaxing scrubbing during debugging. Disabled rules are preserved in your configuration and can be re-enabled at any time.
Adding a New Rule
- Go to Gateway > Rules in the sidebar.
- Click Add Rule.
- Select the Rule Type (Remove, Replace, Hash, or Rename).
- Enter the Field Name to match. Use dot notation for nested fields.
- If the rule type is Replace or Rename, enter the target value or new field name.
- Set the Priority number. Lower numbers run first.
- Click Save.
The rule takes effect immediately for all new events.
Default Scrubbing
Even without custom rules, PixelsCleared applies built-in scrubbing to every event:
- Email addresses are detected and removed from all fields
- Phone numbers are detected and removed from all fields
- IP addresses are hashed with SHA-256
- URL query parameters are stripped
- User agent strings are removed
- Sensitive keywords trigger full field removal
Custom rules run on top of these defaults. You cannot disable the default scrubbing behavior.