Use the release 2.x that supports most of Commerce feature.
This is a contribution module to Drupal Commerce.
Warning
Commerce Google Tag Manager has been deprecated and recommends transitioning to the Google Tag module, up to release 2.x, as a direct replacement.
Originally developed as a straightforward integration for Commerce applications, Google Tag now fully supports most features of this module, rendering it unnecessary.
For a comprehensive report on backported features and any missing functionalities, please refer to issue #3357144.
Provides Commerce integration for Enhanced Ecommerce via Google Tag Manager.
In the case you are looking for the documentation of version 7.x, see the previous Project Page for Drupal 7.x.
Features
The module tracks automatically the following Universal Analytics Enhanced Ecommerce events:
- Views of Product Details when viewing a commerce product entity;
- Additions or Removals from cart;
- Checkout with the possibility to track checkout options;
- Purchases.
All events are tracked server-side and stored in the session. The next "regular" page views loads all stored events via Ajax and pushes them to Google Tag Manager via Data Layer.
Also, this module offers a service commerce_google_tag_manager.event_tracker
to track other Enhanced Ecommerce events such as Product Impressions. Of course, it's up to you - as developers - to implement the usage of this service.
For those needing high customisation & control over data sent to Google Analytics, this module offers events listed on EnhancedEcommerceEvents
to alter data before sending them.
How to use
Once installed & enabled, this module will work out-of-the-box. Nothing needs to be configured in your Drupal 8 installation excepted your Container ID (GTM code formatted as GTM-xxxxxx
).
Therefore, you will need to handle the configuration inside Google Analytics and Google Tag Manager.
- Enable
Commerce
andCommerce Google Tag Manager
; - Configure your Container ID of Google Tag Manager on /admin/config/system/google_tag.
Google Analytics
- Enable
Ecommerce
andEnhanced Ecommerce Reporting
in the settings of your property; - Add labels for each checkout step under
Checkout Labeling
(optional).
👉See the complete documentation to setup Google Analytics for Commerce Google Tag Manager.
Google Tag Manager
You will need to create separate tags and triggers for each of the tracked Enhanced Ecommerce events.
1. First of all, create triggers of events type Custom Event
with the following event names:
addToCart
;removeFromCart
;productDetailViews
;checkout
;purchase
.
2. Then, create tags for each trigger.
👉See the complete documentation to setup Google Tag Manager for Commerce Google Tag Manager.
Versions
Commerce Google Tag Manager is available for both Drupal 8 & Drupal 9 !
The version 8.x-1.x
is not compatible with Drupal 8.8.x
.
Drupal 8.8.x
brings some breaking change with tests and so you
must upgrade to 8.x-2.x
version of Commerce Google Tag Manager.
Which version should I use?
Drupal Core | Commerce Google Tag Manager | Drupal Commerce | Drupal Google Tag |
---|---|---|---|
8.7.x | 1.x | 2.8 | 1.3 |
8.8.x | 2.x | 2.8 | 1.3 |
9.x | 2.x | 2.20 | 1.4 |
Dependencies
This module requires the GoogleTagManager module & the obvious Commerce module.
Installation
We highly recommend you to install the module using composer
.
Once installed, just enable the module and check if transactions are transferred to Google Analytics.
You can debug it with Chrome extension Tag Assistant.
Similar modules
At first sight Commerce Google Tag Manager offers similar functionality to the module Commerce Google Analytics, although Commerce Google Tag Manager will normalise the way your data are sent to Google Analytics by automatically dispatch events, thus reducing the need to do anything in the Drupal side.
Project information
- Unsupported
Not supported (i.e. abandoned), and no longer being developed. Learn more about dealing with unsupported (abandoned) projects - Obsolete
Use of this project is deprecated. - Module categories: E-commerce
- 828 sites report using this module
- Created by parisek on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-2.x-dev updated 10 Oct 2016 at 11:13 UTC
Development version: 7.x-1.x-dev updated 27 Jul 2015 at 19:43 UTC