Implement Enhanced eCommerce Tracking in Google Analytics

Liquid error: undefined method `name' for nil:NilClass


coreFORCE enterprise supports the analytics data requirements of Google enhanced eCommerce tracking, but there are several steps required on Google's site to set it up. To implement enhanced eCommerce, do the following:


1. Sign up for Google Analytics


If you do not already have a Google Analytics account, sign up for that first at You will be required to sign in with a Google account and identify the website you want to use with Analytics. There is an introduction from Google here:


Do not use the Google Analytics tracking tag. For enhanced eCommerce, you will need to use the Google Tag Manager tracking tag.


2. Sign up for Google Tag Manager


For tracking website visits and demographics, Google Analytics is sufficient, but in order to use enhanced eCommerce, you also need to sign up for Google Tag Manager (GTM). GTM is a separate product that integrates with Google Analytics and replaces the Analytics tracking tag with a much more flexible tagging system.  Sign up for GTM at


There is an introduction from Google here:


3. Link Google Analytics to Tag Manager


Follow these steps from Google to create an Analytics tag in GTM that will link your analytics account with your tag manager account:


You will create a tag called Analytics in GTM and enter your Google Analytics Tracking ID (starting with UA-...) in the configuration.



Publish your changes to Google Tag Manager by clicking on the Overview tab, clicking Submit in the upper right corner, and then clicking Publish.



4. Add the GTM tracking tag to coreFORCE


Once you have signed up for Google Tag Manager and connected it to your Google Analytics instance, you will need to add the tracking tag to coreFORCE. In GTM, there will be an identifier starting with GTM- in the header section.  Click on that to open a popup that contains the javascript tag manager code. It should look like the following screenshot. Click the copy button in the top code snippet to copy the code. Ignore the bottom snippet as it is not needed for coreFORCE.



In coreFORCE, click on Website > Templates > Analytics Code. If you do not already have an Analytics snippet created, click Add to create one. If you already have one created (e.g. for Zaius), you can edit it. Paste the GTM code into the Code box. It can coexist with other analytics platforms if you are already using one or more.



Save changes on the Analytics code. Then in Website > Templates > Templates, open the template for your site (typically it will begin with your business name). On the Javascript Tab, select the analytics code snippet you just created from the dropdown and save the template.



You can test the connection by visiting the front end of your coreFORCE site and then checking in Google Analytics to verify that your traffic is being tracked.


5. Add script to push the ecommerce purchase event to Google in the coreFORCE order response fragment


In coreFORCE, go to Orders > Setup, and click on the Fragments tab. Filter the list by Order Response, and select customize for the fragment that appears. Click Save to create the Fragment.



In Website > Fragments, locate the fragment that was just created, called RETAIL_STORE_ORDER_RESPONSE. Paste the following HTML code (without modification) into the bottom of that fragment.


<script> let transactionProducts = []; for (var i in orderData.orderItems) {    transactionProducts.push({        'id': orderData.orderItems[i].upcCode,        'name': orderData.orderItems[i].description,        'price': orderData.orderItems[i].salePrice,        'brand': orderData.orderItems[i].productManufacturer,        'category': orderData.orderItems[i].productCategory,        'quantity': orderData.orderItems[i].quantity    }); }
let ecomData = {    'purchase': {      'actionField': {        'id': orderData.orderId,        'revenue': orderData.orderTotal,        'tax':orderData.taxCharge,        'shipping': orderData.shippingCharge,      },      'products': transactionProducts    } }; 
dataLayer.push({'event':'eec.purchase', 'ecommerce':ecomData}); </script>


6. Turn on enhanced eCommerce in Google Analytics


In Google Analytics, you will need to enable enhanced eCommerce for your site. Click on Admin (next to the gear icon in the lower left corner), and then find eCommerce Settings in the right column.



In eCommerce settings, make sure Enable Ecommerce and Enable Enhanced Ecommerce Reporting are turned on.



7. Create enhanced eCommerce tags in Google Tag Manager


The last step to enable enhanced eCommerce tracking from coreFORCE is to create Tags and Triggers in GTM that will listen for the events that coreFORCE will send. There are 5 triggers and 5 events. They are all set up exactly the same except for the name of the custom event. The event names are these:


  1. eec.detail - view product details
  2. eec.add - add product to cart
  3. eec.remove - remove product from cart
  4. eec.checkout - start checkout
  5. eec.purchase - place an order


The following will walkthrough the process to create the eec.detail event. These steps should be repeated for each of the 5 events.


A. In Google Tag Manager, click on Triggers, and then click New in the upper right.



B. Give the Trigger a name, and then click on "Choose a trigger Type to begin setup". In the trigger type pane that opens, click Custom Event.



C. Enter the event name as eec.detail, and select "This trigger fires on all custom events".


D. Click on Tags in the left side bar and click New.



E. Give the Tag a name, click on "Choose a Tag Type to begin setup" and then click on "Google Analytics: Universal Analytics" in the Tag Type pane.



F. Enter the following settings in the Tag Configuration.


  • Track Type: Event
  • Category: type {{Event}}
  • Action: type {{Event}}
  • Enable overriding settings in this tag
  • Tracking ID: enter your Google Analytics tracking ID
  • Under More Settings, in Enable Enhanced ecommerce Settings, select True
  • Check Use Data Layer


G. Click on Choose a Trigger to Make this tag fire, and select the Detail trigger that you just created.


H. Click Save to complete the tag configuration.


I. Repeat the previous steps for each of the 5 ecommerce events listed above.


8. Publish changes in Google Tag Manager


Once you have completed all of your trigger and tag setup, in the Overview tab in Google Tag Manager, click on the Submit button in the upper right corner, and then click Publish, as you did in step 3 above. This will make your changes live.


Once all of these steps are completed, you will begin to see ecommerce metrics reflected in Google Analytics as customers shop on your site. This information will appear under Conversions > Ecommerce.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article