There used to be a file called checkout.liquid. You could put any script you liked in it. It is gone now, and new stores never had it.
In its place came Customer Events, also known as the Web Pixels API. In Shopify Admin, under Settings, there is a page called Customer events, and there you can add your own code with Add custom pixel.