GA4 setup using GTM
Go to the Tag Manager site and sign in to the Tag Manager:

Next, is to create an account:

Click on the Create Account button. This will take you to the Account Setup page:

To complete the account setup enter your account name and select your country. Next, for container setup enter your website name and choose the target platform as Web:

After creating the account the Google Tag Manager pop-up will appear:

Copy the <head> tag code and paste it into the below path in Admin Panel – Store Configuration >> External Service Settings >> Digital Marketing tab >> Google Tag Manager:

Copy the <body> tag code and paste it in the below location of Admin Panel – Store Personalization >> Language Text References >> search ‘noscript message’:

To get the UA code, follow the below-given steps –
- Click on the Admin from the left hand side panel:

- From the Admin screen, click on the Create Account button.

- In the account setup steps, enter the account name the same as the Google Tag Manager account name, select "Google products & services" checkbox and click on the Next button.

- In the next step, enter the property name and then expand the advanced options.

- From the Advanced Options, toggle the button for "Create a Universal Analytics property", enter your website URL, select the first radio button "Create both a Google Analytics 4 and a Universal Analytics property" and then click on Next button.

- Specify your Business details in the 3rd step.
- Click on the Create button. Complete the terms and services agreement step.
For Universal Analytics (UA) code :
- Navigate back to the Admin page, select the created account and UA property from the drop down and then click on the Tracking Info >> Tracking Code option as shown below:

- Your Tracking Code will appear like this -

For Measurement ID (GA4):
- Navigate back to the Admin page and select the created account and GA4 property from the drop-down:

- Select the Data Streams from the options below, select Web from the Data Streams page and then click on the URL:

- From the Web Stream Details page, copy and save the Measurement ID for further steps.

For the next step, you can proceed with either of the setups:
OR