Set up Google Tag Manager for ecommerce
1. Choose ecommerce events that fit your business goals.
That could be product impressions, product clicks, product detail impressions, add/remove to cart, promotions impressions, promotion clicks, checkout steps, purchases, and refunds.
2. Look for each ecommerce event and its respective dataLayer event templates on the GTM Guides.
All the events templates are available at the official documentation on Google Tag Manager’s site.
3. Push events to the dataLayer.
Every time an event occurs on your site you can send those events as objects to the dataLayer through your front end or by pulling the same information from your site. By setting the following product detail event on the dataLayer GTM reads the data and is able to transfer it to Google Analytics.
4. Create Custom Event triggers for each ecommerce event with the exact event name to activate its ecommerce object.
Within the Triggers section, create a new trigger and select the Custom Event type. In the trigger configuration, complete the event name with the name of the event pushed to the dataLayer. For example, addToCart.
5. Create a Google Analytics Tag to measure the ecommerce events and choose the custom events as triggers.
Use one tag for all the events or create one tag for each event. For example, if you want to track a product detail, create an event tag for Google Analytics, choose the event parameters that adjust your business goals like Category: Enhanced Ecommerce, Action: Product Detail, and Label: the name of the product. Set the Non-interaction Hit as true and choose as triggers the custom event you created to measure product details.
6. Enable Enhanced Ecommerce features within your Google Analytics Settings variable in GTM.
This feature enables you Google Analytics configuration to read the ecommerce data you will push to the dataLayer and then use to populate the tags which will send the events to Google Analytics. In your Google Analytics variable within More Settings, you’ll find the Ecommerce options.
7. Use the Google Tag Manager’s preview mode or the Google Chrome extension Tag Assistant to test each ecommerce event on your website.
Verify the events are pushed at the right time and it is reflected on the Google Analytics reports, including all the data you set on the event’s setup.