Before spending a couple of hundred dollars on an electronic swing trainer spend $10 or so on two new doormats. Why two? Because you are going to stand on one and practice shots off the other. One of the troubles even with practice mats is that too often one's feet are lower than the mat. And that can give deceptive results.
Get some white tape. Stick a line of tape along what will be the far side of the practice mat, about an inch or so in from the edge. Leave room at the front for a practice ball. Then lay down another white line at an angle that corresponds to your takeaway and delivery, running from the ball to the rear edge of the mat. The exact angle you choose is up to you, since it depends on whether your swing is upright or flat.
Now in the backyard, or even indoors, use the outer line for aiming practice. Get behind it. See where it points. Then step round as if addressing the ball and ''square up'' your stance. Do this often. Also practice taking the club back on the same line every time, using your angled line. Use the mats on the practice range too. They'll pay for themselves!