Mautic Know-How
Mautic Know-How
Mautic Tutorials for Beginners & Tips for Specialists

Housekeeping: Help the Mautic Datenbank Stay Lean

The Mautic database tends to grow huge very quickly, especially when integrated on higher-traffic web sites. A large percentage is basically junk, though. Here are some simple tricks to reduce that drastically.

Note that at the same time this addresses GDPR requirements for deleting old data.

 

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).

Your browser is outdated!

Please update your browser to see this website correct. Update your browser now

This web site uses cookies and the web analysis tool Google Analytics. By continuing to use these pages, you accept that policy.

An opt-out is available inside our Data Privacy Statement.
Agreed