Enhanced eCommerce Variable Pack for Shopify

October 15, 2019
By Kyle Jacoby,
Analytics Consultant

Easily grab eCommerce data for your site built on Shopify with this Google Tag Manager (GTM) container. The variables navigate the default Shopify checkout object and pull useful information that can be used for third-party tags and pixels. This is useful in cases where you do not have a DataLayer implemented and can be used as a quickstart for getting your third-party tags and pixels rolling.
 
To that end, here is a baseline set-up of variables which navigate the Shopify Object and captures values that can be used for other third-party tags and pixels, including:

Variable Type Example Value
JS - Checkout Email String test @gmail.com
JS - Checkout Step String billing_information
JS - Currency Code String USD
JS - Customer ID Number AC-1234
JS - Discount Amount Number 24
JS - Discount Code String SAVE15
JS - Estimated Price Number 144
JS - Is Purchase String Non-Purchase
JS - Line Items Array [hat,scarf,shoes]
JS - Total Revenue Number 152.04
JS - Order ID String 12345
JS - Product IDs Array [12345,12344,12333]

This recipe expands on our previous enhanced eCommerce variable pack by adding more Shopify specific variables that can be used at your own discretion. 

Including: 

  • Checkout Email
  • Customer ID
  • Discount Amount
  • Discount Code
  • Estimated Price (pre-checkout value)
  • Line Items
  • Product SKU IDs
  • Product Titles

For information on the documentation used to navigate the Shopify Object refer to the Shopify help center on the checkout object

If a DataLayer was implemented correctly then you can refer to the recipe post, Enhanced eCommerce Variable Pack, where there is a collection of variables that are sourced from the DataLayer.

Ingredients

Triggers

Pageview - Purchase

Variables

JS - Checkout Email

JS - Checkout Step

JS - Currency Code

JS - Customer ID

JS - Discount Amount

JS - Discount Code

JS - Estimated Price

JS - Is Purchase

JS - Line Items

JS - Order ID

JS - Product IDs

JS - Product SKU IDs

JS - Product Titles

JS - Shopify Global

JS - Total Product Value

JS - Total Revenue

Instructions

1. Download Container File

Download the container JSON file.

(You may need to right-click on the link and choose “Save Link As” or “Save Target As” to save the JSON file to your computer.)

2. Import JSON File into GTM

Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Check out How to Import a Container into GTM for more details about importing a container file.

3. Add Variables and Triggers As Needed

These variables and triggers won’t affect your current tracking in any way. Rather, they provide you with the building blocks necessary to enhance other tags with consistent information from the Shopify Checkout Object.