There is no real way to do it with the MyQ equipment you are referencing. This equipment is UL listed and designed for overhead operators. They do not detect linear motion, the gate operators do not have the same necessary safety features.
A possible workaround is listed in the link above, but I wouldn’t generally recommend it. It is certainly not a UL listed solution. Gate operators from liftmaster/Chamberlain are being released which are directly MyQ compatible, but this would require replacement of the gate operator and last we were informed, there are zero retrofit options for a Gate.