With the right GA4 audience setup, you can automate personalized email journeys—like abandoned cart reminders, wishlist promotions, or browse recovery flows—by connecting GA4 signals to platforms like Klaviyo, Mailchimp, or Customer.io.
🧰 Prerequisites
Tool | Role |
---|---|
OpenCart v3/v4 | Storefront and event source |
Google Tag Manager | For pushing custom events |
Google Analytics 4 | Destination for event + audience logic |
Email Platform (CRM) | To trigger email journeys (Klaviyo, Mailchimp, etc.) |
🎯 Use Cases for Email Journeys
User Behavior | Email Trigger Example |
---|---|
Viewed a product | “Still thinking about this item?” |
Added to cart but no buy | “Complete your purchase and save 10%” |
Viewed promo but no click | “Your exclusive offer is waiting” |
Visited X times this week | “Welcome back—our latest arrivals!” |
📦 Step 1: Push Key Events into GA4 via GTM
Update your OpenCart templates to push events to dataLayer
.
Examples:
A. product.twig
– View Item Event
<script>
dataLayer = dataLayer || [];
dataLayer.push({
event: 'view_item',
item_id: '{{ product.product_id }}',
item_name: '{{ product.name }}',
category: '{{ category_name }}'
});
</script>
B. add_to_cart
Listener via JS
<script>
document.querySelector('.btn-add-to-cart').addEventListener('click', function() {
dataLayer.push({
event: 'add_to_cart',
product_id: '{{ product.product_id }}',
name: '{{ product.name }}',
price: '{{ product.price }}'
});
});
</script>
C. Wishlist or Compare Actions
If you have buttons or links:
dataLayer.push({
event: 'add_to_wishlist',
product_id: '12345'
});
🧱 Step 2: Configure GA4 Events in GTM
For each custom event:
- Go to GTM > Tags > New
- Tag Type: GA4 Event
- Event Name:
add_to_wishlist
(oradd_to_cart
, etc.) - Event Parameters:
product_id
:{{DLV - product_id}}
item_name
:{{DLV - item_name}}
Trigger: Custom Event = add_to_wishlist
(match your push)
Repeat this for each behavioral event.
🧠 Step 3: Build Audiences in GA4
Go to GA4 Admin > Audiences > New Audience
A. Abandoned Cart Audience
- Include users who:
- Triggered
add_to_cart
- AND not triggered
purchase
- Triggered
- Membership Duration: 3–7 days
You can include conditions like
cart_value > 50
orcategory = shoes
.
B. Product View Audience
- Include users who:
- Viewed an item (
view_item
) - AND not
add_to_cart
orpurchase
- Viewed an item (
🔁 Step 4: Export GA4 Audiences to Email Platforms
GA4 audiences can’t natively send to email platforms. Use these options:
Option 1: Connect GA4 to Google Ads
- Go to GA4 > Admin > Product Links > Google Ads
- Link your GA account
Export audiences to Google Ads, sync to tools like Klaviyo via Zapier or BigQuery pipelines.
Option 2: Use BigQuery + Email Platform Integration
- Export GA4 events and audiences to BigQuery
- Run queries to detect audience IDs
- Send user emails or UIDs to Mailchimp/Klaviyo via API
Example SQL:
SELECT user_pseudo_id, event_name
FROM `project.dataset.events_*`
WHERE event_name = "add_to_cart"
AND NOT EXISTS (
SELECT 1
FROM `project.dataset.events_*`
WHERE event_name = "purchase"
AND user_pseudo_id = e.user_pseudo_id
)
Automate sending this to Klaviyo’s list/segment API
📨 Step 5: Trigger Email Campaigns in CRM
In your CRM:
- Import segment of GA4 users
- Create behavior-based journeys:
Trigger Audience | Email Flow |
---|---|
Added to Cart (no buy) | Abandonment series (1–3 emails) |
Viewed Promo (no click) | Reminder with limited-time offer |
Viewed Product (no action) | Personalized recommendation mail |
🔒 Step 6: Respect Consent
If you’re using Cookiebot or similar:
- Only push events to GA4 after marketing/statistics consent
- Use GTM’s consent checks on all GA4 tags
Example condition:
Cookiebot.consents.marketing equals true
🧪 Step 7: QA Events and Audience Membership
Tool | Use |
---|---|
GA4 DebugView | Confirm events are recorded |
GTM Preview Mode | Validate event triggers and variables |
GA4 Audience Overview | See real-time audience size + preview |
CRM Logs | Ensure email platform receives data |