Zend certified PHP/Magento developer

Get grand total and customer data variables

I’m using Magento 2.4 and I’m trying to get grand total and customer data variables to be inserted to Google tracking code.

I’ve followed the link below to create custom module to call $block->getGrandTotal but it’s not work !
https://magento.stackexchange.com/a/116922/105485

This is google code which I’ve to fill it with magento variables :

<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-595825986/_BYQCLj7tr0DEMKqjpwC',
      'value': <?php echo $totall;?>,
      'currency': 'SAR',
      'transaction_id': ''
  });
</script>
<script>
  dataLayer.push({
    'event':'purchase',
    'order_value':'verraible for order value',
    'order_id':'order_id',
    'enhanced_conversion_data': {
      "email": 'yourEmailVariable',   
      "phone_number": 'yourPhoneVariable',
      "first_name": 'yourFirstNameVariable',
      "last_name": 'yourLastNameVariable',
      "street": 'yourStreetAddressVariable',
      "city": 'yourCityVariable',
      "region": 'yourRegionVariable',
      "postal_code": 'yourPostalCodeVariable',
      "country": 'yourCountryVariable'
    }
  })
</script>