Deep Segments
Overview
The Deep Segments module in cmercury enables you to track key user interactions on your website—such as “Add to Cart,” “Sign Up,” and “View Product”—and build behavioral segments based on those actions. This allows you to create highly targeted email campaigns, analyze user engagement over specific timeframes (e.g., 7-day or 30-day activity), and gain deeper insights into user journeys and buying intent.
By capturing real-time website behavior like page views, product interactions, and custom events, Deep Segments empowers marketers to personalize experiences, enhance segmentation accuracy, and drive better campaign performance.
Prerequisites
- Availability: Deep Segments is available only on paid plans.
- Activation: The feature must be manually enabled.
Setting Up Deep Segments
Step 1: How to Enable Deep Segments
- Go to Account Settings.
- Select the Deep Segments tab.
- Toggle the Status to “Enabled”.
Once enabled, you can begin tracking user behavior through script integration and event definitions.
Step 2: Add the Tracking Script to Your Website
Before you can track user engagement events and create Deep Segments, you need to integrate the email tracking script into your website. This enables cmercury’s email analytics system to collect user data for segmentation and reporting.
- Navigate to Deep Segments > Add New Website.
- Enter your website URL (e.g., https://yourwebsite.com).
- Select the Mailing List to associate visitor data.
- Choose the Website Type: Ecommerce or Others.
- Click Add Website.
- Once added, click Get Script to copy your site-specific tracking code.
Note: Each script is domain-specific. Add separate entries for development or staging domains if needed.
Installing the Script
Paste the copied script into the <head> section of every page on your website. Once installed, page view tracking will be enabled by default.
Step 3: Define Events
Once the tracking script is active, you can define the specific events you want to track. These events represent key user actions on your website.
Tracking Pre-defined and Custom Events
Beyond page views, you can manually trigger specific user actions using the cwtag() JavaScript function. This enables advanced segmentation based on user behavior.
cwtag('event', 'event_tag', {
// event-specific parameters
});
Commonly Used Predefined Events
These events are typically used in ecommerce platforms. When using these predefined tags (such as add_to_cart, view_product, etc.), ensure that the format and keys in your event payload exactly match the examples provided below. This is essential for the events to be recognized and processed correctly by our system.
1. New User Sign-Up
Tag: sign_up
Tracks when a new user signs up on your website. The attribute keys (2,3,521 etc) are the attribute IDs from the audience list selected during the initial setup. Replace them with that of your audience list.
cwtag('event', 'sign_up', {
user_email: 'newwebsiteuser@website.com',
attributes: [{
2: 'FirstName',
3: 'LastName',
521: '9999999999'
}],
attributesMap: [{
2: 'First Name',
3: 'Last Name',
521: 'Phone Number'
}],
attributesType: [{
2: 'String',
3: 'String',
521: 'Numeric'
}]
});
2. Product Category Page Visit
Tag: product_listing
Captures visits to a category or listing page.
cwtag('event', 'product_listing', {
page_type: "WebsitePageType",
product_category_name: "Mobile"
});
3. Product Page View
Tag: view_product
Tracks views of individual product pages.
cwtag('event', 'view_product', {
product_id: "sku123",
product_name: "Mango 16 Pro Max mobile",
product_image_url: "https://website.com/img/dafsa.jpg",
product_price: 100000,
product_category_id: 29,
product_category_name: "Mobile"
});
4. Add to Wishlist
Tag: wishlist
Tracks wishlist additions.
cwtag('event', 'wishlist', {
product_id: "sku123",
product_name: "Hysong S25 mobile",
product_image_url: "https://cmercury.com/img/4232.jpg",
product_price: 75559,
product_category_id: 29,
product_category_name: "Mobile"
});
5. Add to Cart
Tag: add_to_cart
Captures when users add a product to their cart.
cwtag('event', 'add_to_cart', {
product_id: "sku123",
product_name: "Nokia 2310 mobile",
product_image_url: "https://cmercury.com/img/4222.jpg",
product_price: 2668,
product_category_id: 29,
product_category_name: "Mobile"
});
6. Remove from Cart
Tag: remove_from_cart
Tracks cart removals.
cwtag('event', 'remove_from_cart', {
product_id: "sku123"
});
7. Conversion (Purchase Completed)
Tag: conversion
Records successful transactions.
Single Product:
cwtag('event', 'conversion', {
product_id: "sku1237"
});
Multiple Products:
cwtag('event', 'conversion', {
product_id: "sku123,sku1237"
});
8. Custom Events
For advanced tracking, you can send custom events tailored to your specific use case. These are ideal for recording interactions that aren’t covered by the predefined ecommerce tags.
⚠️ Important: When sending custom events, you must use the custom_event keyword instead of event in the cwtag() function.
Tag: custom_event
Use this for unique site-specific interactions.
Tag: custom_event
Use this for unique site-specific interactions.
cwtag('custom_event', 'OnlineGame', {
parameters: [{
TimeStarted: '10am',
Game_Name: 'Ludo',
Completed_Hours: '2'
}],
parametersType: [{
TimeStarted: 'String',
Game_Name: 'String',
Completed_Hours: 'Numeric'
}]
});
You can rename the OnlineGame tag to match your use case—e.g., VideoPlayed, QuizCompleted, or SubscriptionChanged.
Best Practices for Using Deep Segment
- Define Key Goals: Identify the most important actions (e.g., purchases, sign-ups) to track.
- Use Meaningful Time Frames: Customize your analysis windows—e.g., 7 days for cart behavior, 30 days for purchases.
- Combine Events for Better Insights: Analyze patterns across multiple actions (e.g., add to cart → purchase).
- Use Behavior & Demographics: Refine segmentation by combining event data with user traits (e.g., location, device).
Troubleshooting
- No Data in Deep Segments: If your Deep Segments isn’t showing any data, ensure that the tracking script is properly implemented and that the event conditions are set correctly.
- Event Not Triggering: Double-check the event setup parameters and confirm that the correct triggers (e.g., button clicks, page views) are defined.
Need Help?
Reach out to support@cmercury.com for assistance with custom setup or troubleshooting.
Conclusion
Deep Segments gives you granular control over behavioral tracking and email segmentation. By leveraging real-time interaction data, you can create smarter campaigns, boost conversions, and drive higher engagement with your audience.