How to track Google events using Google Tag Manager and Universal Analytics?

I recently started tracking events on my site using some custom code I found on this forum and a direct universal analytics code that I added in the custom code section of Webflow. Everything worked fine, but I would prefer to integrate analytics using google tag manager, so I set up google tag manager and now the custom code for tracking events no longer works. The analytics are working, but tracking events is not working.

Does anyone know what code I can use to get events to track again?

The custom code that used to work, in the footer section, is:

<script>
  $(document).ready(function() {      
    $(document).on('click', '[data-gatrack]', function(e) {

      var $link = $(this);
              var commaSeperatedEventData = $link.data('gatrack');
              var eventParams = commaSeperatedEventData.split(',');

              if (!eventParams) { return; }

              eventCategory = eventParams[0]
              eventAction = eventParams[1]
              eventLabel = eventParams[2]

              gtag(
                  'event',
                  eventAction,
                  {
                      'event_category': eventCategory,
                      'event_label': eventLabel
                  }
              )
        
    });
  });
  </script>

===========================

Then inside the designer, I added a data-ga-track element to the buttons I want to track. This had worked well previously, but once I switched over to delivering analytics through Google Tag Manager, the events stopped tracking.

No one has figured out event tracking with Google Tag Manager and Webflow?