Setting Up Google Analytics 4 with Google Tag Manager: A Comprehensive Step-by-Step Guide
Step 1: Create a Google Analytics 4 Property
- Log in to your Google Analytics account and navigate to the Admin section.
- Click on the “Create Property” button in the Property column.
- Select “Google Analytics 4” as the Property type and fill in the required information, such as the Property name and URL.
Step 2: Set up Data Streams
- In the “Data Streams” section, click on “Add Stream” and select “Web”.
- Enter your website’s URL and click on “Create stream”.
- Copy the Measurement ID that is generated.
Step 3: Install Google Tag Manager
- Sign in to your Google Tag Manager account or create a new one if you don’t have one yet.
- Click on “New Account” and fill in the required information, such as the Account name and country.
- Create a new container and select “Web” as the target platform.
- Copy the container snippet code that is generated.
Step 4: Add Google Tag Manager Code to your Website
- Paste the Google Tag Manager container snippet code into the header of your website’s HTML code, just before the closing </head> tag.
- Save and publish the changes to your website.
Step 5: Set up Google Tag Manager to track Google Analytics 4
- In Google Tag Manager, click on “Add a new tag”.
- Choose “Google Analytics: GA4 Configuration” as the tag type.
- Enter your Measurement ID in the “Measurement ID” field.
- Save the tag and give it a name.
- Click on “Submit” to publish the changes.
Step 6: Set up Triggers and Variables
- Create a new trigger by clicking on “Triggers” and then “New” and select “Page View” as the trigger type.
- Give the trigger a name and save it.
- Create a new variable by clicking on “Variables” and then “New”.
- Choose “Google Analytics: GA4 Configuration” as the variable type and select the tag you created earlier.
- Save the variable.
Step 7: Test and Publish
- Preview and debug the Google Tag Manager setup by clicking on the “Preview” button and navigating to your website.
- Verify that data is being sent to your Google Analytics 4 Property by checking the Real-Time reports in your Google Analytics account.
- Once you have verified that the setup is working correctly, click on “Submit” to publish the changes to your Google Tag Manager container.