Google Analytics 4 (GA4) is the latest version of Google Analytics. It is a more powerful and flexible analytics platform that can help you track and measure your website traffic and conversions.
To track your website traffic with GA4, you need to install the GA4 tracking code on your website. The tracking code is a piece of JavaScript code that tells Google Analytics how to collect data from your website.
There are two ways to install the GA4 tracking code:
- Google Tag Manager: Google Tag Manager is a free tool that allows you to manage your website’s tracking codes without any coding knowledge.
- Manually: You can also install the GA4 tracking code manually by adding it to the <head> of your website’s HTML code.
Installing the GA4 Tracking Code with Google Tag Manager
To install the GA4 tracking code with Google Tag Manager, follow these steps:
- Go to the Google Tag Manager website and sign in to your account.
- Click on the Create a New Tag button.
- Select Universal Analytics (GA4) Enhanced Measurement from the list of tag templates.
- Enter your GA4 property ID in the Tracking ID field.
- Click on the Save button.
- Click on the Publish button to publish your changes.
Installing the GA4 Tracking Code Manually
To install the GA4 tracking code manually, follow these steps:
- Open the HTML code of your website.
- Add the following code to the <head> of your website’s HTML code:
<!-- Google Analytics 4 -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-987654321');
</script>
Replace G-987654321
with your GA4 property ID. 3. Save your changes.
Installing the GA4 Tracking Code on Different Platforms
Here are guides on how to install GA4 on different platforms:
- WordPress: To install GA4 on WordPress, you can use a plugin like Google Analytics for WordPress by MonsterInsights. This plugin will automatically add the GA4 tracking code to your website.
- Shopify: To install GA4 on Shopify, you can use Google Analytics for the Shopify app. This app will automatically add the GA4 tracking code to your website.
- Wix: To install GA4 on Wix, you can use the Google Analytics Integration app. This app will automatically add the GA4 tracking code to your website.
- BigCommerce: To install GA4 on BigCommerce, you can use the Google Analytics app. This app will automatically add the GA4 tracking code to your website.
- Weebly: To install GA4 on Weebly, you can use the Google Analytics Integration app. This app will automatically add the GA4 tracking code to your website.
- Sitejet: To install GA4 on Sitejet, you can use the Google Analytics app. This app will automatically add the GA4 tracking code to your website.
- Duda: To install GA4 on Duda, you can use the Google Analytics Integration app. This app will automatically add the GA4 tracking code to your website.
- Joomla: To install GA4 on Joomla, you can use the Google Analytics Integration plugin. This plugin will automatically add the GA4 tracking code to your website.
Conclusion
Installing the GA4 tracking code is a simple process that can help you track and measure your website traffic and conversions. By following the steps in this blog post, you can easily install the GA4 tracking code on your website, regardless of the platform you are using.