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.
It can be quite tricky to add Google Analytics to Magento store, especially if you’re doing it manually. It involves multiple steps while configuring tags, setting up tracking codes, and ensuring they’re loaded in the right place. Moreover, you may face issues with caching or other extensions. This may be time-consuming if you’re not very familiar with Magento’s structure.
So why go through all that when there are extensions that can set it up in minutes?
You may find the following guide helpful https://magefan.com/blog/add-google-analytics-4-to-magento-2