Customer Happiness survey on every Nth ticket closure

Customer Happiness survey on every Nth ticket closure

Hi there,
I work in a B2B customer service, and we would like to send the Customer Happiness survey to, let's say, after every 20th ticket closure. We have multiple tickets coming from our clients' customer service people, so the email addresses are quite often the same. Sometimes, there are 5 tickets coming from same account/client within 10 minutes, and it would be an overkill to send a survey after each ticket to same people.

We would like to have the possibility to set the variable N by ourselves for different departments, as some for some departments it would make sense to be e.g. every 5th, and to some every 20th ticket that would get the survey. This does not seem to be possible directly under the Customer Happiness, but can this be achieved with the Custom Functions?