I just got it in the Liquid code of the embedded extension. Liquid provides a bunch of Shopify specific objects for easy access (https://shopify.dev/docs/api/liquid/objects). To get the customer id we just used the liquid customer object like this: “customer.id”.
We didn’t need to get it in JavaScript.