Pmax scripts to optimise high ROAS and Low ROAS products

Hi everyone,

I'm having a lot of products in my feed and currently everything is come into one campaigns. That means i could be spending a lot of money in low performing products. Does anyone have suggestions on how to optimise these more effectively or have any scripts to share? Thank you so much!