QuickBooks HelpQuickBooksHelpIntuit

Mailchimp Site Tracking Pixel Integration Guidance

by Intuit• Updated 4 days ago

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.

Set Up the Mailchimp Site Tracking Pixel for Wix

Set Up the Mailchimp Site Tracking Pixel for WooCommerce

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:

MethodPurpose
trackSend behavioral events (page views, purchases)
identifyAssociate 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

ParameterTypeRequiredDescription
eventTypestringYesThe type of event (see Event Types below)
eventDataobjectYesEvent-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

ParameterTypeRequiredDescription
typestringYesThe identifier type (see Identifier Types below)
valuestringYesThe identifier value

Returns

Promise<void> - Resolves when the identity association is queued.

Identifier Types

TypeDescriptionExample Value
EMAILPlain text email addresscustomer@example.com
EMAIL_SHA256SHA-256 hashed email (lowercase)89e01536... (64-char hex)
PHONEPlain text phone number+15551234567
PHONE_SHA256SHA-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

FieldTypeRequiredDescription
idstringYesUnique variant ID
productIdstringYesUnique product ID
titlestringYesProduct name
pricenumberYesPrice (numeric, not formatted)
currencystringNoISO 4217 currency code
skustringNoStock keeping unit
imageUrlstringNoProduct image URL
productUrlstringNoProduct page URL
vendorstringNoBrand or vendor name
categoriesstringNoArray 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:

FieldTypeRequiredDescription
itemobjectYesProduct variant object (see Product Object above)
quantitynumberNoQuantity added
pricenumberNoLine total (quantity Ă— unit price)
currencystringNoISO 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:

FieldTypeRequiredDescription
idstringYesCart identifier
lineItemsarrayNoArray of cart line items
totalPricenumberNoCart total
currencystringNoISO 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:

FieldTypeRequiredDescription
idstringYesCheckout identifier
cartIdstringYesAssociated cart ID
lineItemsarrayNoArray of cart line items
totalPricenumberNoOrder total after all adjustments
subtotalPricenumberNoSubtotal before tax/shipping
totalTaxnumberNoTax amount
totalShippingnumberNoShipping cost
currencystringNoISO 4217 currency code
discountsarrayNoApplied discount codes
customerIdstringNoCustomer 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
});
FieldTypeRequiredDescription
querystringNoSearch query text
resultsCountnumberNoNumber 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'
});
FieldTypeRequiredDescription
categoryIdstringNoCategory identifier
categoryNamestringNoCategory 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.

Mailchimp