September 21, 2021

A Practical Guide to Set Up Shopify Google Analytics for Collecting Transaction Data Integrated with Your Profit Calculator

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.

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. 

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

Shopify hosts the webserver and manages the checkout path URL setting. 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. It is not straightforward to add a pixel, compared with WooCommerce. Shopify Plus customers only can view and modify checkout. liquid path, and customize the tracking for specific data collection.

In this article, I’m going to instruct you on how to install Google analytic eCommerce tracking correctly. By the end of this article, you can pick up the methods to set up Shopify Google Analytics. The website can collect transaction data and customized data. 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

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.

I would recommend you separate the web and app tracking at the moment. First, the reason is that it’s a beta version, many features are not in place yet. And the current operation interface is too simple to find and set up the tracking for your business. Secondly, 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.
  • Log in and click the 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. First of all, you go to “Online Store” > “Preferences” in Shopify. Secondly, you click the checkbox for the use of enhanced eCommerce and click save.
  2. You log in to the Google Analytics account and click the admin and the eCommerce settings.
  3. You enable eCommerce and Enhanced Ecommerce Reporting.

Shopify automatically hooks the analytics code in your theme as they have a full pre-built enhanced eCommerce analytics integration. You can check the eCommerce report in analytics 24 hours after your first sale is generated

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

Step 1: List data fields in Google Analytics

Add Transaction List:

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

Add Item List:

  • id
  • SKU
  • name
  • list_name
  • brand
  • category
  • variant
  • list_position
  • quantity
  • currency code
  • price

Step 2: Collect variable data

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 the 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. Then you add this script into the Shopify Settings, Checkout, and 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:

  • You log into your Google Analytics account and click the admin and select the filtered view and click the Goals.
  • Create a new goal.
  • Select the place an order, or custom.
  • 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. This page doesn’t exist, but Shopify shows the virtual pageview data. You just confirm equals to is selected as the destination: 

Your funnel can be viewed in “Goals” > “Funnel Visualization”. You can add the “Cart” page as a step, which has the URL /cart. If you do this, set the “Required” option to “No”. 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 lets you create a hypothesis for split-tests. Moving your brand collection in the header navigation to the first link may help people more quickly find what they want to increase sales.

  • 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 the admin and Property Settings.
  • Turn on the Use enhanced link attribution.

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 most people come to your blog and stay longer time.

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 says it is a problem. eCommerce consultants and store owners would see a drop in conversion rate. 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. If you set it up correctly, you can identify the impact on purchases.

To set up content groups:

  • Log in to your analytics, and then go to Admin.
  • Select the view who’s data you can edit as per the best practice
  • Click Content Grouping + 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.

  • Group by tracking code: The most customized approach requires you to group pages by a custom JavaScript snippet. Then, you can use this report 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 make this my favorite option. You can use regular expressions based on the URL, page title, or content description value. Extract additional data with parenthesis if it is 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: It lets you apply customized rules using logics 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/(.*?)$

If you finish 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. 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 tags can facilitate you to name the specific campaign, medium, source, keyword, etc. You can learn the transaction performance from different channels, which are Facebook, Youtube, email, or specific content campaigns, etc. If the purchase occurs on the website, you can learn the transaction data of AOV, CPS, and ACoS by channels.

Conclusion

You have been already collecting Shopify transaction-related data and visualize it in Google Analytics. Also, you can split out the deep-dive level data by events. As I talked about 9 Google Sheet Formulas Plus 1 Add-on for e-Commerce Marketing, 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.

  • Support my channel through PayPal (paypal.me/Easy2digital)
  • Subscribe to my channel and turn on the notification bell Easy2Digital Youtube channel.
  • Follow and like my page Easy2Digital Facebook page
  • Share the article to your social network with the hashtag #easy2digital
  • Buy products with Easy2Digital 10% OFF Discount code (Easy2DigitalNewBuyers2021)
  • You sign up for our weekly newsletter to receive Easy2Digital latest articles, videos, and discount code on Buyfromlo products and digital software
  • Subscribe to our monthly membership through Patreon to enjoy exclusive benefits (www.patreon.com/louisludigital)

Leave a Reply

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