Google Analytics Enhanced Ecommerce for Drupal using Googel Tag Manager
Are you looking Drupal Ecommerce and Enhanced Ecommmerce Tracking using Google Tag Manager to sales details in Google Analytic
Recently one client ask me to implement drupal ecommerce tracking using Google Tag Manager to push all the purchase information to track in Google Analytic. once I looked possible track ecommerce tracking for Drupal, I need put transaction details into the Data Layer on success/Order Confirmation Page!, I have written a data layer on success page to push ecommerce tracking datalayer in Google Analytic to see sales detail in Google Analytic.
First Install Google Tag Manager on Drupal Google Ecommerce Tracking for Google Tag Manager Ecommerce Tracking on Putting code For Drupal <head> and <body>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-XXXX’);</script>
<!– End Google Tag Manager –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXX”
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –>
Note: Make you will replace GTM Tracking Code with your GTM ID XXXXX
Product Detail Impressions: To Track product impression for Drupal Enhanced Ecommerce Tracking using Google Tag Manager used custom javascript to get the value of price, product and brand etc
Written a data layer code to push Ecommerce tracking for Drupal Ecommerce tracking in Google Analytic using Google Tag Manager
dataLayer.push({
‘event’: ‘orderComplete’,
‘transactionId’: “<%= order.number %>”,
‘transactionTotal’: <%= order.total.to_f %>,
‘transactionTax’: <%= order.tax_total.to_f %>,
Now it’s time to verify result in Google Analytic E-commerce tracking in Drupal using Google Tag Manager
Warning:if you do n’t know about javascript/ Datalayer/Jquery or do n’t have developing knowledge then do n’t try Drupal Ecommerce Tracking using Google Tag Manager without touching Codea custom javascript without using Any plugin that can broke your site, Cart and other functionality
Disclaimer: Google tag manager belongs to Google property
For Contact: mappchero@gmail.com
I am available for Hire on Freelancer: Freelancer.com
I am available for Hire on Upwork: Upwork.com
I am available for Hire on Peopleperhour: Peopleperhour.com
I am available for Hire on Guru: Guru.com