Events and User Data Tracking

Events tracking and user data tracking allow you to send behavioral data from your Shopify store to MoEngage. After you track these events, you can use them to build segments, trigger campaigns, and personalize communication based on user actions on your store.

Tracked Events

MoEngage tracks the following events when you enable them on your Shopify app during integration.

Event Type Event Name Description
Product Event Product Viewed MoEngage tracks this event when a user views a product page. Use this to send back-in-stock alerts or personalized product recommendations.
Note: This event is triggered only on the default Shopify product page template. Users who store that use custom product page templates require additional implementation. For more information, contact the MoEngage Support team
Product Event Product Searched MoEngage tracks this event when a user searches for a product. Use this to personalize recommendations based on search intent.
Cart Event Shopify - Add To Cart / Shopify - Update Cart MoEngage tracks this event when a user adds a product to the cart or updates the cart. Use this to trigger the cart-abandonment campaigns.
Cart Event Removed from Cart MoEngage tracks this event when a user removes a product from the cart.
User Login Event Customer Registered MoEngage tracks this event when a customer registers with the Shopify store. Use this for welcome messages and onboarding flows.
User Login Event Customer Logged In MoEngage tracks this event when a customer logs in to the store.
User Login Event Customer Logged Out MoEngage tracks this event when a customer logs out of the store.
Checkout Event Shopify - Checkout Started MoEngage tracks this event when the customer initiates checkout.
Checkout Event Shopify - Checkout Updated MoEngage tracks this event when the customer updates their cart during checkout.
Order Event Shopify - Order Placed MoEngage tracks this event when a customer completes a purchase. Use this for order confirmation messages, loyalty-program nudges, or subscription prompts.
Order Event Shopify - Order Fulfilled MoEngage tracks this event when you fulfill an order, and it is ready to ship.
Order Event Shopify - Order Partially Fulfilled MoEngage tracks this event when you fulfill some, but not all, items in an order.
Order Event Shopify - Order Cancelled MoEngage tracks this event when you cancel an order.
Order Event Shopify - Refund Created MoEngage tracks this event when you create a refund, either due to a cancellation or a complaint. Use this to send personalized communication and reduce churn.
warning

Note

Do not use "moe_" as a prefix when you name events, event attributes, or user attributes. It is a reserved system prefix. Using it might result in periodic blacklisting without prior communication.

Types of Events

Two sources generate events in the MoEngage Shopify integration:

  • Webhook: Shopify generates these events and sends them directly to MoEngage via the Shopify webhook system. These represent server-side signals that the Shopify backend triggers, for example, when a user places an order or starts a checkout.
  • Web SDK: The MoEngage JavaScript SDK running in the browser generates these events based on user behavior on your store frontend — for example, a product page view or a search action.

Both sources capture some events, such as Add to Cart and Checkout Started. This means that two separate event records can appear in MoEngage for the same user action, each with a different name and different attributes.

info

For any event that both Webhook and the Web SDK track, use the Webhook version when building segments or triggering campaigns.

MoEngage receives webhook events directly from the Shopify backend; they are the more reliable signal for campaign logic. Web SDK events are useful for triggering on-site messages that must fire in real time within the browser session.

If you use both versions of the same event in a single campaign or journey, you will cause conflicts and prevent a single consistent event-triggered flow from running.

Event Attribute Requirements

Product URL and Image URL in Webhook Events

Webhook events do not include the product URL or image URL in their payloads. These attributes are present only when you capture the event by using the Web SDK.

To obtain these attributes: If you sync your product catalog to MoEngage, you can pull the product URL and image URL from the catalog at send time by using Product set-based personalization. For more information, refer to the User Actions Model.

Shopify Customer Metafields

MoEngage does not sync Shopify customer metafields, custom data fields attached to the Shopify customer object, to MoEngage user profiles by default. MoEngage also does not include them in event attributes.

To pass this data in a custom manner, refer to the Track Custom User Attributes section below.

Track Custom Events via Shopify Liquid

If you must track events beyond the MoEngage default set, for example, a wishlist action or a custom button click, you can add them using the MoEngage Web SDK in your Shopify theme's Liquid files.

library_add_check

Before You Start

This procedure requires editing your Shopify theme files, which requires developer access. Check with your web team before you make changes.

Step 1: Identify the Correct Liquid File to Edit

Shopify themes use Liquid template files to render pages. To find the right file, perform the following steps:

  1. Log in to your Shopify Admin.
  2. Go to Online Store > Themes.
  3. Locate the theme you want to edit and click the Actions (three dots) button.
  4. Select Edit code from the drop-down menu.
  5. Browse the sections/ folder.

The file you edit depends on where the event should trigger:

  • Product page actions: Edit  sections/product-template.liquid or sections/main-product.liquid.
  • Collection page actions: Edit the relevant collection section file.
  • All pages: Edit layout/theme.liquid. Use this file sparingly.

Step 2: Add the Track-Event Call

In the Liquid file, locate the HTML element the user interacts with. Add a JavaScript call to the MoEngage track_event method.

No Attributes With Attributes Example: Wishlist
Moengage.track_event("EVENT_NAME");

Step 3: Validate That the Event Fires

To validate that the event fires correctly, refer to the Validate Integration documentation.

Track Custom User Attributes

You can pass custom attributes (such as metafields) to MoEngage profiles by using the following workarounds.

Liquid-Based Method for Public Metafields

If you enable storefront access for the metafield, it can be read directly in Shopify Liquid. To find the correct file and add the code, perform the following steps:

  1. Log in to your Shopify Admin.
  2. Go to Online Store > Themes.
  3. Locate the theme you want to edit and click the Actions (three dots) button.
  4. Select Edit code from the drop-down menu.
  5. Open layout/theme.liquid.
  6. Inside the <body> tag, after you initialize the MoEngage SDK, add the following code:
{% if customer %}
<script>
  Moengage.add_user_attribute("Loyalty Tier", "{{ customer.metafields.loyalty.tier.value }}");
  Moengage.add_user_attribute("Custom Attribute", "{{ customer.metafields.custom.attribute_name.value }}");
</script>
{% endif %}

Replace loyalty and tier with the actual namespace and key of your metafield. The {% if customer %} guard ensures the code only runs when a customer is logged in. 

Server-Side Sync for App-Owned Metafields

If a third-party app created the metafield, storefront access is typically set to None. In this case, you must perform a server-side integration:

  1. Subscribe to the customers/update Shopify webhook.
  2. In your webhook handler, use the Shopify Admin API to read the customer’s metafield values.
  3. Call the MoEngage Data API to update the corresponding user attributes on the customer’s profile.

Sample Event Payloads

The payload samples below show the attributes available for reference when building segments and personalizing event data. Full payload samples for each event are shown below.

Sample Payloads for Webhook Events

Shopify - Update Cart Removed From Cart Shopify - Checkout Started Shopify - Checkout Updated Checkout Updated after Shipment Shopify - Order Placed Order Partially Fulfilled Shopify - Order Fulfilled Shopify - Order Cancelled Shopify - Refund Created
{
    "Event Received Time": "17th July 2023, 03:25:55 pm",
    "Product Title": "Sample Product",
    "Updated At": "17th July 2023, 03:26:15 pm",
    "Variation ID": "123456",
    "Currency": "USD",
    "cart_token": "c1-fcdd3207bee3eef9f98abefaf2ca...",
    "Product ID": "845236547",
    "Price": 555.99,
    "Source": "Shopify",
    "Vendor Name": "845236547",
    "Created At": "17th July 2023, 03:25:55 pm",
    "Quantity": 2
}

Sample Payloads for Web SDK Events

Product Viewed Product Searched Add to Cart Update Cart Removed From Cart Customer Registered Customer Logged In Checkout Started
{
    "Event Received Time": "17th July 2023, 03:25:55 pm",
    "Email": "john.doe@example.com",
    "Product Title": "Sample Product",
    "Variation ID": "123456",
    "Total Variants": 3,
    "Product Handle": "Product 1",
    "Available": true,
    "Currency": "USD",
    "Product ID": "845236547",
    "Price": 555.99,
    "Source": "Shopify",
    "Quantity": 3,
    "First Session": true,
    "URL": "https://yourstore.myshopify.com/products/view"
}

Tracked User Properties

MoEngage tracks the following user attributes when you enable them during integration.

Attribute Name Description
First Name The first name of the user.
Last Name The last name of the user.
Mobile The mobile number of the user.
Email The email address of the user.
Shopify ID The user's ID within Shopify.
Shopify LTV The lifetime value of the user

Configuration for Event and User Tracking

To select the events and user properties that MoEngage tracks, perform the following steps:

  1. Navigate to the Configuration tab in your Shopify app.
  2. Select the user events and properties you want to track.
  3. Click Save configuration.

Configuration screen in the MoEngage Shopify app

info

If you have questions about your Shopify integration, refer to the MoEngage Shopify FAQs.

Previous

Next

Was this article helpful?
1 out of 2 found this helpful

How can we improve this article?