Matomo 500 error at sendBeacon

hi we recently migrated from Piwik to matomo and all the tracking data from the site has transferred without any issues. but when we update the tracking code we get the 500 error (in developer view) and there is no tracking data shown.

when i look at the error in the matomo.js file the error is at the send beacon statement

dB=g.sendBeacon(du,dt)}catch(dy){return false

have i missed something in the migration or how do i got about resolving thiis - any help would be much appreciated.