Segment code deployment depending on domain

Hi all,

I have an ecommerce on Webflow and using Segment to track events. I have configured two sources for Segment, one for mydomain.webflow.io and another for mydomain.com.

In the script I have the two codes where I have to comment/uncomment whenever I deploy changes either in dev or prod. Does anybody know how to make it by code? Let me explain myself, is there a way on JS I might distinguish on which domain it is deployed and put the proper code on that deployment so I don’t have to comment/uncomment codes?

Thank you in advance