Add GA ecommerce tags in GTM
Add GA ecommerce tags in GTM
1. In Google Analytics, navigate to Admin > Ecommerce Settings and toggle Enable E-commerce on.
2. Click on Tags > New Button > Tag Configuration to create a Universal Analytics tag and set Track Type to Transaction.
3. Enter your Tracking ID and tracking or campaign parameters like category, action, label, and value.
4. Add data layer variables to your page to allow GTM to read and use information from your site.
Add this code to the section of your web page, above your container snippet.
5. Populate your data layer with transaction information to make GA ecommerce tracking with GTM work.
All transaction and product data should pass through the data layer with these variables: Required Transaction Data: TransactionID and TransactionTotal Required Product Data: Name, SKU, Price, and Quantity.
6. Put the ecommerce dataLayer.push code above the GTM script so that the data layer is ready when GTM fires the GA tag.
Alternatively: Add the code at the bottom of the GTM container on a Thank you page. Activate the code on a page that’s not reloaded after a successful purchase. A dataLayer.push() with minimum required ecommerce object for purchase looks like this:
7. Click on Trigger > New > Trigger Configuration > Click - Just Links to create a trigger.
Enable Wait for Tags. Disable Check Validation. Select Some Clicks from This trigger fires on.
8. Click on Click URL > Ends With > input the data layer code and then save so that the tag fires on the page with your data layer.
9. Test the tag with GTM to see if it fires on the right place and time as the data layer.
Enable Debug and Preview Mode. Open the page you’re tracking. Complete a purchase.