Cron Jobs for Cleanup
Mautic comes with simple console command for clean-up pruposes, see https://docs.mautic.org/en/setup/cron-jobs for details.
a) Cleanup data
For audit log entries, anonymous contacts, and visitor page hits) older than a certain age:
php /path/to/mautic/app/console mautic:maintenance:cleanup --days-old=365 --dry-run
You can also add the ‘--gdpr’ flag to delete known leads that have been inactive for 3 years.
b) Clean up unused IPs
Deletes IP addresses that are not used in any other database table:
php /path/to/mautic/app/console mautic:unusedip:delete
Campaigns for contact cleanup
Now here comes the charming part: Why not use Mautic to clean up Mautic?
The basic idea is:
- Define criteria for what you want to get rid of
- Create segment(s) with filters to reflect those criteria
- Create campaign to delete contacts in those segments
Example 1: "Single-Click Users (before yesterday)"
Anononymous users with just a single click can occur for various reason (bots, non-cookie visitors, ...) - in most cases they are considered junk. So why not get rid of them?
Segment filters:
"Visited URL Count equals 1"
AND
"Visited URL Date less than -2 days"
Example 2: "Delete certain contacts that have been inactive for more than 60 days"
If you want to be more granular than "mautic:maintenance:cleanup" (and especially than the --gdpr flag), you can use the same trick as before, e.g.
Segment filters:
"Visited URL Date less than -60 days"
and combine this with other criteria of your choice (e.g. score).