
Get the job done with a pro
From training to full-service marketing, our community of partners can help you make things happen.
Mailchimp Site Tracking Pixel Integration Guidance
Note
The Mailchimp Site Tracking Pixel SDK is currently in beta. API methods and event schemas are stable but may evolve based on customer feedback.
This guide provides reference material for the Mailchimp Site Tracking Pixel client-side JavaScript API. Use these methods to track user behavior and identify visitors on your website.
About this resource
This content applies to Wix and WooCommerce Mailchimp integrations.
This advanced guidance is recommended for users familiar with custom coding. Contact your developer, or hire a Mailchimp Expert for assistance.
For more information on the set up process for each integration, check out these resources.
Accessing the API
After the Pixel SDK is loaded on your page, access it via:
window.$mcSite.pixel.api
The API Provides two main methods:
| Method | Purpose |
|---|---|
| track | Send behavioral events (page views, purchases) |
| identify | Associate a known identity with the visitor |
track() Method
Sends a behavioral event to Mailchimp for analytics and marketing automation.
Syntax
window.$mcSite.pixel.api.track(eventType, eventData);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| eventType | string | Yes | The type of event (see Event Types below) |
| eventData | object | Yes | Event-specific payload data (refer to examples below) |
identify() Method
Associates a known user identity (email, phone, etc.) with the current anonymous visitor. This enables Mailchimp to connect behavioral data with your audience contacts.
Syntax
window.$mcSite.pixel.api.identify({
type: 'IDENTIFIER_TYPE',
value: 'identifier_value'
});
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | The identifier type (see Identifier Types below) |
| value | string | Yes | The identifier value |
Returns
Promise<void> - Resolves when the identity association is queued.
Identifier Types
| Type | Description | Example Value |
|---|---|---|
| Plain text email address | customer@example.com | |
| EMAIL_SHA256 | SHA-256 hashed email (lowercase) | 89e01536... (64-char hex) |
| PHONE | Plain text phone number | +15551234567 |
| PHONE_SHA256 | SHA-256 hashed phone (E.164 format) | a1b2c3d4... (64-char hex) |
Event types
The SDK supports the following event types. Each event has specific payload requirements.
PAGE_VIEWED
Tracks when a user views a page. This event is automatically sent when autoTrack is enabled.
window.$mcSite.pixel.api.track('PAGE_VIEWED', {});
No additional data required—browser context is captured automatically.
PRODUCT_VIEWED
Tracks when a user views a product detail page.
window.$mcSite.pixel.api.track('PRODUCT_VIEWED', {
product: {
id: 'productVariantId-123',
productId: 'productId-123',
title: 'Classic Cotton T-Shirt',
price: 29.99,
currency: 'USD',
sku: 'TSHIRT-BLU-M',
imageUrl: 'https://example.com/images/tshirt-blue.jpg',
productUrl: 'https://example.com/products/classic-tshirt',
vendor: 'Example Brand',
categories: ['Apparel', 'T-Shirts', 'Men']
}
});
Product Object
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Unique variant ID |
| productId | string | Yes | Unique product ID |
| title | string | Yes | Product name |
| price | number | Yes | Price (numeric, not formatted) |
| currency | string | No | ISO 4217 currency code |
| sku | string | No | Stock keeping unit |
| imageUrl | string | No | Product image URL |
| productUrl | string | No | Product page URL |
| vendor | string | No | Brand or vendor name |
| categories | string | No | Array of category names |
PRODUCT_ADDED_TO_CART
Tracks when a user adds an item to their shopping cart.
window.$mcSite.pixel.api.track('PRODUCT_ADDED_TO_CART', {
cartId: 'cart_abc123',
product: {
item: {
id: 'productVariantId-123',
productId: 'productId-123',
title: 'Classic Cotton T-Shirt',
price: 29.99,
currency: 'USD',
sku: 'TSHIRT-BLU-M'
},
quantity: 2,
price: 59.98,
currency: 'USD'
}
});
Cart Line Item Object:
| Field | Type | Required | Description |
|---|---|---|---|
| item | object | Yes | Product variant object (see Product Object above) |
| quantity | number | No | Quantity added |
| price | number | No | Line total (quantity × unit price) |
| currency | string | No | ISO 4217 currency code |
PRODUCT_ADDED_TO_WISHLIST
Tracks when a user adds a product to their wishlist.
window.$mcSite.pixel.api.track('PRODUCT_ADDED_TO_WISHLIST', {
wishlistId: 'wishlist_xyz789',
product: {
id: 'productVariantId-123',
productId: 'productId-123',
title: 'Classic Cotton T-Shirt',
price: 29.99,
currency: 'USD'
}
});
CART_VIEWED
Tracks when a user views their shopping cart.
window.$mcSite.pixel.api.track('CART_VIEWED', {
cart: {
id: 'cart_abc123',
lineItems: [
{
item: {
id: 'productVariantId-123SKU-12345',
productId: 'productId-123',
title: 'Classic Cotton T-Shirt',
price: 29.99
},
quantity: 2
},
{
item: {
id: 'productVariantId-456',
productId: 'productId-456',
title: 'Slim Fit Jeans',
price: 79.99
},
quantity: 1
}
],
totalPrice: 139.97,
currency: 'USD'
}
});
Cart Object:
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Cart identifier |
| lineItems | array | No | Array of cart line items |
| totalPrice | number | No | Cart total |
| currency | string | No | ISO 4217 currency code |
CHECKOUT_STARTED
Tracks when a user begins the checkout process.
window.$mcSite.pixel.api.track('CHECKOUT_STARTED', {
checkout: {
id: 'checkout_def456',
cartId: 'cart_abc123',
lineItems: [
{
item: {
id: 'productVariantId-123',
productId: 'productId-123',
title: 'Classic Cotton T-Shirt',
price: 29.99
},
quantity: 2
}
],
subtotalPrice: 59.98,
totalTax: 4.80,
totalShipping: 5.99,
totalPrice: 70.77,
currency: 'USD',
customerId: 'cust_789',
discounts: [
{
code: 'SAVE10',
amount: 5.99,
type: 'percentage'
}
]
}
});
Checkout Object:
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Checkout identifier |
| cartId | string | Yes | Associated cart ID |
| lineItems | array | No | Array of cart line items |
| totalPrice | number | No | Order total after all adjustments |
| subtotalPrice | number | No | Subtotal before tax/shipping |
| totalTax | number | No | Tax amount |
| totalShipping | number | No | Shipping cost |
| currency | string | No | ISO 4217 currency code |
| discounts | array | No | Applied discount codes |
| customerId | string | No | Customer identifier |
PURCHASED
Tracks a completed purchase/order.
window.$mcSite.pixel.api.track('PURCHASED', {
order: {
id: 'order_ghi789',
lineItems: [
{
item: {
id: 'productVariantId-12345',
productId: 'productId-12345',
title: 'Classic Cotton T-Shirt',
price: 29.99,
sku: 'TSHIRT-BLU-M',
vendor: 'Example Brand'
},
quantity: 2,
price: 59.98
}
],
subtotalPrice: 59.98,
totalTax: 4.80,
totalShipping: 5.99,
totalPrice: 70.77,
currency: 'USD',
customerId: 'cust_789'
}
});
SEARCH_SUBMITTED
Tracks when a user performs a search.
window.$mcSite.pixel.api.track('SEARCH_SUBMITTED', {
query: 'blue cotton shirt',
resultsCount: 42
});
| Field | Type | Required | Description |
|---|---|---|---|
| query | string | No | Search query text |
| resultsCount | number | No | Number of results found |
PRODUCT_CATEGORY_VIEWED
Tracks when a user views a product category or collection page.
window.$mcSite.pixel.api.track('PRODUCT_CATEGORY_VIEWED', {
categoryId: 'cat_123',
categoryName: 'Men\'s T-Shirts'
});
| Field | Type | Required | Description |
|---|---|---|---|
| categoryId | string | No | Category identifier |
| categoryName | string | No | Category display name |
Disabling auto-track
By default, the SDK automatically tracks PAGE_VIEWED events. To disable this:
// Set BEFORE the MC.js script loads
window.disable_mailchimp_pixel_autotrack = true;
Custom code support
Our Mailchimp Support team isn't trained for in-depth Javascript nor PHP troubleshooting. If you need a developer to help you set up the Mailchimp Site Tracking Pixel, check out our great Experts Directory. This lists third-party Mailchimp experts who can be hired to help out.
Technical Support
Have a question?
Paid users can log in to access email and chat support.