Drupal Ecommerce Tracking in Google Analytic

Standard

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.

Google Analytics Enhanced Ecommerce for Drupal

Implementing Analytics eCommerce tracking in Drupal

First Install Google Tag Manager on Drupal Google Ecommerce Tracking for Google Tag Manager Ecommerce Tracking on  Putting code For Drupal  <head> and <body>

Paste this code as high in the <head> of the page as possible:
<!– Google Tag Manager –>
<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 –>
Additionally, paste this code immediately after the opening <body> tag:
<!– Google Tag Manager (noscript) –>
<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

Data layer Measuring Views of Product Details for Drupal

Implement Google Analytic Tracking Through Google Tag Manager on Drupal

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

Drupal Ecommerce Tracking in Google Analytic

Implemented Analytics eCommerce tracking in Drupal

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

Leave a Reply

Your email address will not be published. Required fields are marked *