ecommerce-gtm
Google Tag Manager Module for Enhanced Ecommerce
This is a Javascript module that implement Google Tag Manager for enahanced ecommerce. It is designed to use GTM snippet.
You can easily use custom dataLayer and additional events. You can use this library in any javascript framework for example:
- react
- angular
- vue etc..
Installation
npm:
npm install ecommerce-gtm --save
Usage
Initializing GTM Module:
# With default dataLayerGTagManager; # with custom data layerGTagManager;
Enhanced Ecommerce
Event example:
# With default dataLayerGTagManager; # Attach ecommerce to an eventGTagManagerevent"test" 'currencyCode': 'EUR' 'impressions': 'name': 'Triblend Android T-Shirt' 'id': '12345' 'price': '15.25' 'brand': 'Google' 'category': 'Apparel' 'variant': 'Gray' 'list': 'Search Results' 'position': 1
Ecommerce only example:
If you do not want to attach ecommerce obj to event try this:
# With default dataLayerGTagManager; # Attach ecommerce to an eventGTagManager
Note:
- Disabling javascript in the browser can prevent the correct operation of this library.