Filter out Error logs

Hi Team,
We are getting some errors logged in our dashboard due to script errors of 3rd party scripts such as Gtm, facebook scripts on user end mostly due to 3rd party cookies getting blocked.

Is there anyway that we can block such logs to be sent to apm, as we have alerts set on errors for core business use-cases, and these error logs are causing unnecessary error alerts.

We are using @elastic/apm-rum in a Nextjs application.