Complete guide how to setup GA4 on Shopify
Step 9. How to implement GA4 select_item event in Shopify
To be able to analyze in Google Analytics 4(GA4) traffic on your pages and report for example when a user selects an item from the list you have to implement GA4 select_item event.
Below, you will find instructions on how to do it using Google Tag Manager and data layer variables in Shopify.
- Firstly, you need to implement an event variable to be able to create select_item trigger. To do that you have to add additional javascript code. You have to find in your Shopify admin > Online store > Themes code snippet responsible for presenting "select_item" HTML element. When you find this HTML element you need to add in this code following code:
dataLayer.push({
'event': 'select_item',
'selected_item_list_id':'{{ collection.id}}',
'selected_item_list_name': '{{ collection.title}}',
'selected_items': [{
item_id: '{{ product.id }}',
item_name: '{{ product.title| replace: '"' , ' ' }}',
price:{{ product.price| money_without_currency }},
'item_list_id': '{{ collection.id}}',
'item_list_name': '{{ collection.title}}'
}]
}); - Define new variables in Google Tag Manager using data layer.
Go to the "Variables",
and in "User-Defined Variables" section click "New" button
then:
a) Create "DL – selected_item" layer variable as follow (chose variable type as "Data Layer Variable")
b) Create “DL – selected_item_list_id” layer variable as follow (chose variable type as “Data Layer Variable”)
c) Create "DL – selected_item_list_name" layer variable as follow (chose variable type as "Data Layer Variable")
- Create a trigger that we use to fire GA4-select_item tag. Go to the trigger section and create a new"CE – select_item" trigger as follow:

- Create GA4 – select_item tag in Google Tag Manger.
Go to "Tags" and click "New" button to add new tag,
and name like “GA4 – select_item”, and then choose tag type and select “Google Analytics: GA4 Event. Next choose your configuration tag that you have already created and set “Event Name” to “select_item” and then setup “Event Parameters” as follow:
then choose your trigger that you have already created a while before (CE – select_item" ).
and click "Save" button on the top right corner, and click "Submit" to published.
Lets go to the next step of our tutorial which is: How to implement GA4 purchase event on Shopify.
Anna Bacciarelli
During twelve years of professional work, I have gained experience in various positions in many fields. The variety of classes and professional experience taught me openness, independence, creativity, a positive approach to people and teamwork.Currently, I would like to focus on a new, extremely interesting path that is IT, and more specifically internet analytics. From the beginning of 2022, I have been gaining experience using the following tools: Google Analytics, Google Tag Manager and Google Data Studio.
If you enjoyed the article please share it:
This guide is all about how to implement Google Analytics(GA4) on Shopify. To setup GA4 on Shopify website we use Google Tag Manger(GTM) and Shopify data layer.
Oct 12, 2022If you want to measure traffic on your Shopify website, the first thing is to create Google Analytics account for your website
Published by Piotr Ulacha
Oct 13, 2022If you have Google Account but you don't have GA4 property yet, because for example you are still using Universal Analytics property (former version of GA4) you have to create new GA4 property.
Published by Piotr Ulacha
Oct 14, 2022Because we will use Google Tag Manger as a method to implement Google Analytics 4 you have to create GTM account.
Published by Piotr Ulacha
Oct 15, 2022If you want to get the best out of Google Analytics 4 apply the following recommended GA4 settings and best practices.
Published by Piotr Ulacha
Oct 16, 2022




