Setting up E-commerce tracking with Tag Manager and Google Analytics 4
Ville Häkkinen
Last Update 2 tahun yang lalu
Prerequisite
In order to succeed with this tutorial, you need basic knowledge of how the google tag manager and analytics work.
Before you continue with this tutorial,
- enable the data layer with your store
- have installed Google Tag Manager on your site
- have Google Analytics basic tracking setup
Google Tag Manager
HeadQ's data layer implementation is compatible with the GA4 e-commerce data model, so implementation is quite straightforward. You only need to create an event trigger and a GA4 event tag to pass the information to Analytics.
Create event Trigger
1. Create a new trigger (Triggers > New)
2. Name the trigger descriptive way (ie. GA4 Ecommerce Event)
3. Select "Custom event" as Trigger Type
4. Add possible events to "Event name" separated by Pipe (|) character
- view_item|add_to_cart|add_to_quote_cart|view_cart|begin_checkout|purchase|request_for_quote|begin_configuration|calculated_price
5. Check "Use regex matching"
6. Toggle "All Custom Events" as triggering firing option
7. Click Save
After configuration Trigger should look something like this
Create GA4 Event tag
- Create a new tag (Tags > New)
- Name the tag descriptive way (ie. GA4 | Ecommerce)
- Select "Google Analytics: GA4 Event" as the Tag Type
- Select the GA4 Configuration tag that you have used to set up normal GA4 tracking. (Google Analytics: GA4 Configuration)
- Select the predefined variable name to Event name by clicking the [+] button and select "Event" (type 6. Custom Event)
- In more settings under Ecommerce, check "Send Ecommerce data" and "Data Layer" as Data Source
- Move to the Trigger section and select the trigger you created in the previous step (ie. GA4 Ecommerce Event) as Firing Trigger.
- Click Save
After configuration Tag should look something like this
The final step is just to Submit workspace changes and you're done.