Hi
magento 2 google analytics 4 install without any cost Default Theme
Content → Configuration → Edit → HTML Head.
5. Once in the HTML Head, copy the codes you got from the GTM. Paste the <head> in the Scripts and Style Sheets section and the <body> code in Footer → Miscellaneous HTML.
6. Click on Save Configuration, and your work is almost done. The next step is to clear the Magento Cache:
System → Cache Management → Flush Magento Cache.