Every coin has two sides. Shopify provides store owners ready-to-use templates and eCommerce friendly URL structures that hugely save eCommerce website creation and increase marketing, operation efficiency. 

However, due to this fixed framework and structure, Shopify can’t facilitate owners to understand granular marketing performance for each SKU transaction data by diversified dimensions, and learn web content insight which can engage, and better convert traffic into sales. All these are critical to optimize SKUs conversion rate and see if the SKU should be continued based on the profit performance.

In particular, Shopify owns the web server and manages the checkout path URL setting. So if you are using the Basic Shopify, Shopify, or Advanced Shopify plans, the web checkout path modification is not available to you to edit or change, which is not that straightforward to add a pixel when comparing to using WooCommerce. Just Shopify Plus customers can view and modify checkout. liquid and customize the tracking for specific data collection.

So in this article, I’m going to instruct you on how to install Google analytic eCommerce tracking on the Shopify website correctly. By the end of this article, you can pick up the methods to set up Shopify Google Analytics, so your website can collect transaction data and custom data like SKU number, order ID, etc. And you can learn e-commerce website-specific content and event engagement and sales performance in a centralized view.

1. Create a Google Analytics Account and Set up a Universal Analytic Property (UA Version)

The event-based and event-driven Google Analytics 4 beta version has launched, and I believe Google might suggest you use this tracking tool that combines web and App tracking and facilitates you to see a full centralized picture in one dashboard.

However, I would suggest you separate the web and app still at the moment. The reasons are because it’s a beta version, so many features are not in place still, or maybe the current operation interface is too simple to find and set up the tracking for your business. Furthermore, Shopify hasn’t integrated with the Google analytics 4 beta version yet. What you can do mostly is by leveraging third-party plugins to collect the transaction data.

Below are the steps to create Google Universal analytics and add the tracking js. to Shopify:

  • Sign-up using your main Google account. Follow Google’s steps to create an account until you come across your tracking code to be installed.
  • Login then click “Admin” at the top and go to “Tracking Info” > “Tracking Code”: Copy your code that will look something like the below, but with your unique UA ID
  • Paste to Shopify Google Analytic Box

2. Enable eCommerce Enhancement Tracking

The enhanced eCommerce plug-in for analytics.js enables the measurement of user interactions with products on eCommerce websites across the user’s shopping experience, including product impressions, product clicks, viewing product details, adding a product to a shopping cart, initiating the checkout process, transactions, and refund.

Steps:

  1. In Shopify go to “Online Store” > “Preferences”. Click the checkbox for “Use Enhanced Ecommerce” then click “Save”:
  2. Go to your Google Analytics account, click “Admin” then “Ecommerce Settings”:
  3. Enable “Ecommerce and “Enhanced Ecommerce Reporting” then save:

Shopify automatically hooks the analytics code in your theme as they have a full pre-built enhanced eCommerce analytics integration. Check the “Ecommerce” report in analytics 24 hours after your first sale following the configurations from this guide.

This is just halfway done if you aim to view more transaction data and integrate it with your SKU profit calculator in a dashboard. For example, at least you also need the product SKU data and exclude the tax and shipping cost out of the revenue column in GA at the moment. 

Step 1: Make a list of data fields which you want to track in Google Analytics, such as:

Add Transaction List:

  • id
  • affiliation
  • revenue
  • coupon
  • tax
  • shipping
  • currency

Add Item List:

  • id
  • SKU
  • name
  • list_name
  • brand
  • category
  • variant
  • list_position
  • quantity
  • currencyCode
  • price

Step 2: Corresponding to the fields above, collect variables from the Shopify store and map accordingly.

Add Transaction

  • “id”: {{order_name|handleize}}, // Transaction ID. Required.
  • “affiliation”: ‘store name’, // Affiliation or store name.
  • “revenue”: {{order.subtotal_price|money_without_currency}},
  • “coupon”: “{{ line_item.quantity }}”,
  • “tax”: “{{ order.tax_price|money_without_currency }}”,
  • “shipping”: “{{ order.shipping_price|money_without_currency }}”,
  • “currency”: “{{shop.currency }}”

Add Item

  • “id”: {{order_name|handleize}}, // Transaction ID. Required.
  • “sku”: “{{ line_item.sku }}”,
  • “name”: “{{line_item.title}}”,
  • “list_name”: “Search Results”,
  • “brand”: “Brand Name”,
  • “category”: “{{ line_item.product.collections[0].title }}”,
  • “variant”: “{{line_item.variant}}”,
  • “list_position”: “1”,
  • “quantity”: “{{ line_item.quantity }}”,
  • “currencyCode”: “{{shop.currency }}”,
  • “price”: “{{ line_item.line_price | money_without_currency}}”

Step 3: In Revenue field “revenue”: {{order.subtotal_price|money_without_currency}}” we added the subtotal of the transaction (Excluded Tax and Shipment/Delivery charges).

You can make changes in the below script according to your requirements. And then add this script into the Shopify Settings > Checkout > Additional Scripts section. Make sure to uncheck the “Enhanced Ecommerce Reporting” option in Shopify.

(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)

})(window,document,’script’,’https://www.google-analytics.com/analytics.js’,’ga’);

ga(‘create’, ‘UA-xxxxxxx-x‘, ‘auto’);

ga(‘require’, ‘ecommerce’);

ga(‘ecommerce:addTransaction’, {

“id”: {{order_name|handleize}}, // Transaction ID. Required.

“affiliation”: ‘store name’, // Affiliation or store name.

“revenue”: {{order.subtotal_price|money_without_currency}},

“coupon”: “{{ line_item.quantity }}”,

“tax”: “{{ order.tax_price|money_without_currency }}”,

“shipping”: “{{ order.shipping_price|money_without_currency }}”,

“currency”: “{{shop.currency }}”

});

{% for line_item in line_items %}

{% assign list_position = forloop.index + 1 %}

{% assign product_category = ” %}

ga(‘ecommerce:addItem’, {

“id”: {{order_name|handleize}}, // Transaction ID. Required.

“sku”: “{{ line_item.sku }}”,

“name”: “{{line_item.title}}”,

“list_name”: “Search Results”,

“brand”: “Brand Name”,

“category”: “{{ line_item.product.collections[0].title }}”,

“variant”: “{{line_item.variant}}”,

“list_position”: “1”,

“quantity”: “{{ line_item.quantity }}”,

“currencyCode”: “{{shop.currency }}”,

“price”: “{{ line_item.line_price | money_without_currency}}”

});

{% endfor %}

ga(‘ecommerce:send’);

3. Set up Funnels and Goals for Shopify Google Analytics

Complete this step by using my Shopify goal checkout template. Super quick. That uses regex and will include product pages. To set up your own funnel:

  • Go to your Google Analytics account, click “Admin”, select your filtered view then click “Goals”
  • Create a new goal.
  • Select “Place an order”, or “custom” (In fact, it’s just naming, and they’re the same thing).
  • Name the goal “Checkout Complete” and select the “Destination” goal type.
  • Enter the goal details exactly like below. This is the standard checkout process for Shopify stores. The page URLs actually don’t exist, but Shopify creates virtual page view data for a consistent URL structure. Confirm “Equals to” is selected as the destination: 

Your funnel can be viewed in “Goals” > “Funnel Visualization”. The report is great because you can see how users enter and exit pages, and if there’s a particular page that causes a lot of drop-offs

You can add the “Cart” page as a step, which has the URL /cart. If you do this, set the “Required” option to “No” because people may skip the cart page (depending on your theme) causing these people to go unreported in the goal.

4. Use Enhanced Link Attribution

Enhanced link attribution is an extra layer of information Google gives you to visually see what people click on. You get to see how people interact with a page. I use it mostly on the home page, product pages, and other highly-viewed pages to see interactions with links. The data then lets you create a hypothesis for split-tests, “Moving our brand collection in the header navigation to the first link may help people more quickly find what they want to increase sales.” or “This section gets less attention than we thought.

  • In Shopify go to “Online Store” > “Preferences”
  • Copy-and-paste the following line of code into the “Additional Google Analytics JavaScript” field of Shopify then save the page:

ga(‘require’, ‘linkid’);

  • Go to your Google Analytics account, click “Admin” then “Property Settings”.
  • Turn on “Use enhanced link attribution” then save.

Use the official Chrome extension Page Analytics made by Google. Then browse your website like a normal user to see the fancy click data.

5. Content Grouping

Let’s say you have a blog for your store. You understand the critical part of content marketing: quality and consistency. Your blog does so well that half the people who come to your store read your blog.

The popularity of your blog means most people who visit your website are immediately uninterested in buying your products. Your conversion rate drops. Is this a problem?

Traditional eCommerce analysis and thinking say it is a problem. Ecommerce consultants and store owners would see a drop in conversion rate then panic. You cannot optimize for conversion if you fail to understand the role content-types have on the purchase process.

Content Groups in Google Analytics help you solve this issue. When set up correctly, you can identify the influence of your blog, support pages, and other types of content have on purchases.

To set up content groups:

  • Log in to your analytics then go to “Admin”
  • Select the view who’s data you can edit as per the best practice
  • Click “Content Grouping” then “+ New Content Grouping”.
  • Cluster pages on your site into groups.

Here are content groups stores could use to better understand user behavior:

  • Blog posts.
  • Collections.
  • Product Pages.
  • Checkout Pages.
  • Marketing Pages. Example pages are ones that talk about your companies values, the manufacturing process, and media mentions.
  • Account Pages.
  • 404 Errors.
  • Support Pages.

There are three options to set a content group so you have to pick the ones best for you.

  • Group by tracking code: the most customized approach that requires you to group pages by a custom JavaScript snippet. Use this as the last resort in Shopify if the other two are insufficient. It requires advanced coding knowledge.
  • Group using extraction: Shopify has a consistent URL structure. Regular expressions for the “Page” option makes this my favorite option. You can use regular expressions based on the URL, page title, or content description value. Extract additional data with parenthesis when possible. What’s inside the parenthesis becomes the group name in reports. All your collections can be broken down into their own group. The rule precedes any rule you may have in “Group using rule definitions”.
  • Group using rule definitions: you won’t use this much but it lets you apply highly customized rules using and/or logic with minimal need for regular expressions.:

Create up to five content groups now for the columns you created in step four. I’ll suggest using “Group using extraction” with these regular expression rules suited for Shopify.

  • Collections: ^/collections/(.*?)$
  • Products: ^.*/products/(.*?)$
  • Pages: ^/pages/(.*?)$
  • Blogs: ^/blogs/(.*?)$

Once you are finished with the configuration of your content groups, you can analyze their performance with primary dimensions and segmentation in standard or custom reports.

6. Break Down Media Channel Performance by Tagging UTM parameters on landing URL

UTM tag is used to add on the website landing URLs, for the purpose to separate the traffic source and the transaction attribution. Basically, there’re two sections in the structure of a URL with adding UTM tags, which is Shopify website URL + UTM parameters

Shopify website URL: https://www.example.com/products/abc

UTM tags: ?utm_campaign=lifestyle&utm_medium=facebook&utm_source=djipocket2

You can try to click through below the article and check the landing on your browser to see the structure.

DJI Pocket 2 vs Osmo Pocket, What’s the difference?

UTM tag can facilitate you to name the specific campaign, medium, source, keyword, etc, so you can learn the transaction performance from different channels, such as Facebook, Youtube, email, or specific content campaigns, etc on Google analytics. As long as the customer checkout occurs on your Shopify eCommerce website, you can fully learn each channel transaction AOV, CPS, ACoS in a hub.

Conclusion

Basically, you have been already collecting Shopify transaction-related data and visualize in Google Analytics, and also specify deep-dive level by events and links based on your actual needs. As I talked about in another article about 9 Google Sheet Formulas Plus 1 Add-on for e-Commerce Marketing. After you set up Shopify Google Analytics, you can create a performance tracker for your eCommerce business by automating all data collection and updating.

I hope you enjoy reading A Practical Guide to Set Up Shopify Google Analytics for Collecting Transaction Data Integrated with the Profit Calculator and find it helpful. If you did, please support us by doing one of the things listed below, because it always helps out our channel.

By Louis Lu

Growth Hacker & Digital Marketer, with a proven record of over 11 years experience in 20+ Asian markets, and 25,000+ connections in Linkedin

Leave a Reply

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