0% found this document useful (0 votes)
143 views7 pages

Ecommerce Tracking in GA4 Via GTM

The document provides steps to set up ecommerce tracking in Google Analytics 4 (GA4) including: 1. Enabling enhanced ecommerce data layer variables in platforms like WordPress and Shopify. 2. Importing and configuring a template to manage ecommerce event and item variables. 3. Creating data layer variables for key ecommerce fields and mapping them to GA4 parameters for tracking purchases and other ecommerce events.

Uploaded by

Mehedi Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views7 pages

Ecommerce Tracking in GA4 Via GTM

The document provides steps to set up ecommerce tracking in Google Analytics 4 (GA4) including: 1. Enabling enhanced ecommerce data layer variables in platforms like WordPress and Shopify. 2. Importing and configuring a template to manage ecommerce event and item variables. 3. Creating data layer variables for key ecommerce fields and mapping them to GA4 parameters for tracking purchases and other ecommerce events.

Uploaded by

Mehedi Hassan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Setup Ecommerce Tracking in GA4

What is Ecommerce Tracking in GA4?

Prerequisite:
https://developers.google.com/tag-manager/ecommerce-ga4

Step-1: Enable Enhanced Ecommerce for Data layer variables


in WordPress & Shopify

Step-2: Import the 'EEC dataLayer Builder for GA4' template

https://tagmanager.google.com/gallery/#/owners/matteo-zambon-gt
m/templates/EEC-dataLayer-Builder-for-GA4

Step-3: Create & Configure 2 Custom Variables using 'EEC


dataLayer Builder for GA4' template

1. Event Name variable - which will manage the name of the


e-commerce event
2. Items variable - which will manage an object that contains all
the parameters

Step-4: Create Data layer variable in GTM


ecommerce.purchase.actionField.id
ecommerce.purchase.actionField.revenue
ecommerce.purchase.actionField.shipping
ecommerce.purchase.actionField.tax
ecommerce.purchase.actionField.coupon
ecommerce.purchase.actionField.affiliation
ecommerce.refund.actionField.id
ecommerce.currencyCode
ecommerce
Step-5: Create & Configure Trigger for GA4
1. EEC Events
gtm4wp.addProductToCartEEC|gtm4wp.checkoutStepE
EC|gtm4wp.productClickEEC|gtm4wp.productImpress
ionEEC|gtm4wp.promoClickEEC|gtm4wp.promoImpress
ionEEC|gtm4wp.removeFromCartEEC

2. EEC Purchase
gtm4wp.orderCompletedEEC

3. GA4 Event Name


Step-5: Create & Configure Tag for Ecommerce tracking as well
as Translating data variables to GA4 Parameters
1. GA4 - EEC tag for Ecommerce events
2. GA4 - EEC - Purchase tag for Purchase event

GA4 Parameters vs UA Parameters


GA4 Universal Description
Parameter Analytics
Parameter

value revenues Transaction revenue

transaction_ id Unique ID for the transaction


id purchase (Required)

currency currencyCode Local currency (Required)

tax tax Taxes from purchase

shipping shipping Shipping costs

coupon coupon Coupon code associated with


purchase

items products List of products purchased from


transaction

Step-6: Testing the Purchase Event


Events: Retail/Ecommerce

Event Trigger Parameters


add_payment_info when a user submits their coupon, currency, items, payment_type,
payment information value

add_shipping_info when a user submits their coupon, currency, items, shipping_tier, value
shipping information

add_to_cart when a user adds items to currency, items, value


cart

add_to_wishlist when a user adds items to a currency, items, value


wishlist

begin_checkout when a user begins checkout coupon, currency, items, value

generate_lead when a user submits a form value, currency


or request for information

purchase when a user completes a affiliation, coupon, currency, items,


purchase transaction_id, shipping, tax, value (required
parameter)

refund when a refund is issued affiliation, coupon, currency, items,


transaction_id, , shippingtax, value

remove_from_cart when a user removes items currency, items, value


from a cart

select_item when an item is selected from items, item_list_name, item_list_id


a list

select_promotion when a user selects a items, promotion_id, promotion_name,


promotion creative_name, creative_slot, location_id

view_cart when a user views their cart currency, items, value

view_item when a user views an item currency, items, value

view_item_list when a user sees a list of items, item_list_name, item_list_id


items/offerings

view_promotion when a promotion is shown to items, promotion_id, promotion_name,


a user creative_name, creative_slot, location_id
function () {
var ref = {{Referrer}};
// don't bother if there is no referrer
if (! ref) return ref;

var newref;

// place your external referrers here (domain


names)
// adding 'mohamedriyaz.co.in' matches
'www.mohamedriyaz.co.in' too
var domains = [
// banks
'stripe.com', 'stripe.de',

// payment providers, cards, foreign banks


'paypal.com', 'paypal.in', 'visa.com'
];

domains.forEach (function (x) {


// loop through domains,
if (ref.match (RegExp ('^ https?: // ([^.]
+ \.)?' + x + '/')))
newref = x;
})

// return referrer, or the new one


return newref?
'https: //' + {{Page Hostname}} + '/
excluded-referrer /' + newref
: ref
}

Data layer: Shopify:


https://apps.shopify.com/gtm-datalayer-by-elevar

You might also like