Mautic Community Forums

How do you keep the data in your Mautic DB trimmed and gdpr compliant?

Hi all

I was wondering how you go about keeping your Mautic DB trimmed and void of old outdated leads. For example, we’re having trouble with our Mautic instance growing at a rapid pace and being slow and difficult to use. One way of managing this would be to delete leads and their data. Is anyone else doing this?

Best regards

Hi there,

Take a look at the documentation: https://docs.mautic.org/en/setup/cron-jobs#cleanup-old-data

Hi @rcheesley

Is it the gdpr compliance you’re referring to? If not, and you’re instead referring to how one keeps the Mautic DB trimmed I don’t think the cron job will help us much. The docs state that Currently supported are audit log entries, visitors (anonymous contacts), and visitor page hits. and we don’t use that functionality of Mautic to any larger extent. We just add our contacts and segment them and send emails through different campaigns. So I don’t think the Cleanup Old Data cron job will do much good for us. What I’m looking for is a way to delete all contacts which haven’t been active (this could be determined by when the last opened an email we sent) in a certain time period. And when a contact has been deleted all the data connected with that contact should also be deleted, which in turn saves significant space

Indeed, the gdpr flag enables you to clean up old leads who are no longer active. Perhaps @npracht could ask the team to give some more insights, as I believe Webmecanik contributed most of the stuff around the GDPR cleanup commands.

I would like to delete leads which have been inactive for more than 1 year. Is it possible to decrease the time period from 3 to 1 year for the gdpr command? If so, I think this cron job would be very useful.

Also, do you know what makes a lead count as inactive? Is it only that it hasn’t opened any emails? Or is it also that we haven’t sent any emails to the lead?

Hi @lalurran !
You can change the date of 3 years in the code, this is not settable. This is just here: https://github.com/mautic/mautic/blob/8ae5196f5ec843b4167c7dffd5da61baab24a65a/app/bundles/CoreBundle/Command/CleanupMaintenanceCommand.php#L85

  • If you use mautic:maintenance:cleanup then all anonymous inactive leads are deleted after 3 years.
  • If you use mautic:maintenance:cleanup --gdpr then all anonymous AND not anonymous will be deleted after 3 years.

Best,

N.

Hi @npracht!

This is wonderful. Thank you! I need some clarification regarding two matters, though:

  1. when using the --gdpr flag and the cron job removes non-anonymous contacts. Is all the data connected to that contact removed? Does the delete cascade through the db?
  2. what makes a contact count as inactive? Is it only that it hasn’t opened any emails? Or is it also that we haven’t sent any emails to the contact?

It is based on last active field. So email opened, page visited, form submited. That should be mainly all.
Concerning the deletion, it should delete everything, we’re using same method as API deletion.

Thank you! I appreciate it.

@npracht @rcheesley This is the output when we run

image

It seems like more than audit log entries, visitors (anonymous contacts), and visitor page hits are affected? Or is user notifications an record type related to one of those?