Skip to main content

Abandoned Cart Data Tracking in Treez Ecommerce

Understand how abandoned cart detection works and what's required to configure abandoned cart data capture in Google Tag Manager (GTM).

B
Written by Beth Graff
Updated today

Key Takeaway

Treez Ecommerce detects abandoned carts and pushes cart data to your Google Tag Manager container. To send abandoned cart emails or SMS, you must connect this data to a messaging platform and configure an automation flow. Refer to your messaging platform's documentation for instructions on connecting with GTM.


Pre-Requisites

You must have your Google Tag Manager ID (GTM-ID) configured on your ecommerce site. Click here for full instructions.


How Abandoned Cart Detection Works

A cart is considered abandoned when all of these conditions are met:

  1. Shopper adds items to their cart

  2. Shopper is identified (via email entry or sign-in)

  3. Checkout is not completed

  4. 10 minutes of inactivity passes

What counts as activity:

  • Navigating between pages

  • Adding/removing cart items

  • Continuing checkout

  • Returning to the site in the same session

Note: The delay is intentional—it prevents false abandonment signals while shoppers are still browsing.


Data Included in the Event

Cart-Level

  • Cart value (total)

  • Currency

  • Store/location context

  • Event timestamp

Item-Level (per item)

  • Product name

  • Product ID / SKU

  • Price

  • Image URL

  • Quantity

  • Brand

  • Category

  • Variant info (if applicable)


Google Tag Manager Setup

Important: GTM only forwards the signal—it doesn't enable messaging by itself


Step 1: Create Data Layer Variables

Before creating triggers or tags, you must set up variables to capture data from the abandon_cart event.

  1. In GTM, go to Variables → User-Defined Variables

  2. Click New to create each variable below

Variable Name

Variable Type

Data Layer Variable Name

Required

DLV - store_id

Data Layer Variable

store_id

For MSO Only

DLV - ecommerce.value

Data Layer Variable

ecommerce.value

Yes

DLV - ecommerce.items

Data Layer Variable

ecommerce.items

Yes

DLV - user_email

Data Layer Variable

user_email

Yes

dlv - cart_value

Data Layer Variable

cart_value

Yes

To create each variable:

  1. Click New

  2. Name the variable (e.g., DLV - store_id)

  3. Click Variable Configuration → select Data Layer Variable

  4. Enter the Data Layer Variable Name (e.g., store_id)

  5. Click Save

Repeat for all five variables:


Step 2: Create Trigger (Custom Event)

Setting

Value

Trigger Name

[Store Name] | abandon_cart

Trigger Type

Custom Event

Event Name

abandon_cart

Trigger Condition for MSOs:

  • DLV - store_id equals <store_id>

    • This ensures the event only fires for the correct store in a shared GTM container.

Example Trigger Configuration:


Step 3: Create GA4 Event Tag

Setting

Value

Tag Name

[Store Name] | GA4 Event | abandon_cart

Tag Type

Google Analytics: GA4 Event

Event Name

abandon_cart

Measurement ID

Use the same Measurement ID already used for that store's ecommerce tracking

Triggering

Select the trigger created in Step 2


Step 4: Add Event Parameters

In the GA4 Event Tag, add the following parameters:

Parameter

Value (GTM Variable)

store_id

{{DLV - store_id}}

value

{{DLV - ecommerce.value}}

currency

USD

user_email

{{DLV - user_email}}

Notes:

  • value must be numeric—this represents the cart dollar amount

  • Currency is strongly recommended so GA4 treats the value correctly

Example Tag Configuration:


GA4 Configuration

Event Visibility

Once live, abandon_cart will appear in:

  • Reports → View User Engagement & Retention → Events

  • Realtime

  • Explorations

Mark as Key Event (Recommended)

To make abandoned carts easier to find in reporting:

  1. Go to GA4 → Admin → Events

  2. Find abandon_cart under Recent events

  3. Mark it as a Key Event

This does not change data collection—it only improves reporting visibility.


Testing & Troubleshooting

What You See

What It Means

"Nothing happened"

Expected—wait ~10 minutes for the inactivity window

No email received

A messaging flow must be active in your platform

"Treez doesn't support abandoned cart"

Treez provides the signal; you provide the messaging


Checklist: Sending Abandoned Cart Messages

  • GTM Data Layer Variables created (store_id, ecommerce.value, ecommerce.items, user_email, cart_value)

  • GTM trigger configured for abandon_cart event

  • GA4 event tag created with event parameters

  • Messaging/loyalty platform connected

  • abandon_cart marked as Key Event in GA4 (optional but recommended)

  • Abandoned cart automation/flow configured and active in messaging platform

Did this answer your question?