Setting Up Google Analytics 4 Gtag

Does anyone know what to enter within the new Gtag JS to map the CS-Cart fields properly?

We have added the GS Tag to our header and it's working, but when adding the purchases tag (see here: https://developers.google.com/analytics/devguides/collection/gtagjs/enhanced-ecommerce#measure_purchases)with it we need to map the field.

Below is the snippet and where I don't know what to add. I very much thank anyone who can help answer this.

gtag('event', 'purchase', {
"transaction_id": "???",
"affiliation": "????",
"value": ???,
"currency": "USD",
"tax": ???,
"shipping": ???,
"items": [
{
"id": "???",
"name": "???",
"list_name": "???",
"brand": "???",
"category": "???",
"variant": "???",
"list_position": ???,
"quantity": ???,
"price": '???'
},
{
"id": "???",
"name": "???",
"list_name": "???",
"brand": "???",
"category": "???",
"variant": "???",
"list_position": ???,
"quantity": ???,
"price": '???'
}
]
});

Check how this functionality is realised in the built-in module

design/themes/responsive/templates/addons/google_analytics/hooks/checkout/order_confirmation.post.tpl

Hello.

Please have a look our addon with such functionality.