Adding conversion custom event to the webinar registration page using javascript

I am trying to add a conversion custom event javascript to the Footer HTML so I can track the webinar registration in my marketing systems. I tried to add GA4 and a custom postMessage but nothing is saved to the footer or header. What is the best way to integrate conversion tracking into the existing webinar registration landing page?