Weird
This original code stopped working, it produced the error "ga is not defined" again. Ihad to replace the first part to get it working again.
Original (stopped working)
on_sent_ok: "ga('send', 'event', 'category', 'action');"
New one
on_sent_ok: "__gaTracker('send', 'event', 'category', 'action');"
Not sure when this happened, maybe after an update of the yoast analytics plugin.