Data Subject Request API Version 1 and 2
Data Subject Request API Version 3
Platform API Overview
Accounts
Apps
Audiences
Calculated Attributes
Data Points
Feeds
Field Transformations
Services
Users
Workspaces
Warehouse Sync API Overview
Warehouse Sync API Tutorial
Warehouse Sync API Reference
Data Mapping
Warehouse Sync SQL Reference
Warehouse Sync Troubleshooting Guide
ComposeID
Warehouse Sync API v2 Migration
Bulk Profile Deletion API Reference
Calculated Attributes Seeding API
Data Planning API
Custom Access Roles API
Group Identity API Reference
Pixel Service
Profile API
Events API
mParticle JSON Schema Reference
IDSync
AMP SDK
Initialization
Configuration
Network Security Configuration
Event Tracking
User Attributes
IDSync
Screen Events
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Push Notifications
WebView Integration
Logger
Preventing Blocked HTTP Traffic with CNAME
Linting Data Plans
Troubleshooting the Android SDK
API Reference
Upgrade to Version 5
Cordova Plugin
Identity
Direct URL Routing FAQ
Web
Android
iOS
Initialization
Configuration
Event Tracking
User Attributes
IDSync
Screen Tracking
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Push Notifications
Webview Integration
Upload Frequency
App Extensions
Preventing Blocked HTTP Traffic with CNAME
Linting Data Plans
Troubleshooting iOS SDK
Social Networks
iOS 14 Guide
iOS 15 FAQ
iOS 16 FAQ
iOS 17 FAQ
iOS 18 FAQ
API Reference
Upgrade to Version 7
Getting Started
Identity
Upload Frequency
Getting Started
Opt Out
Initialize the SDK
Event Tracking
Commerce Tracking
Error Tracking
Screen Tracking
Identity
Location Tracking
Session Management
Initialization
Content Security Policy
Configuration
Event Tracking
User Attributes
IDSync
Page View Tracking
Commerce Events
Location Tracking
Media
Kits
Application State and Session Management
Data Privacy Controls
Error Tracking
Opt Out
Custom Logger
Persistence
Native Web Views
Self-Hosting
Multiple Instances
Web SDK via Google Tag Manager
Preventing Blocked HTTP Traffic with CNAME
Facebook Instant Articles
Troubleshooting the Web SDK
Browser Compatibility
Linting Data Plans
API Reference
Upgrade to Version 2 of the SDK
Getting Started
Identity
Web
Alexa
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Step 9. Test your local app
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Overview
Step 1. Create an input
Step 2. Verify your input
Step 3. Set up your output
Step 4. Create a connection
Step 5. Verify your connection
Step 6. Track events
Step 7. Track user data
Step 8. Create a data plan
Step 1. Create an input
Step 2. Create an output
Step 3. Verify output
Node SDK
Go SDK
Python SDK
Ruby SDK
Java SDK
Introduction
Outbound Integrations
Firehose Java SDK
Inbound Integrations
Compose ID
Glossary
Data Hosting Locations
Migrate from Segment to mParticle
Migrate from Segment to Client-side mParticle
Migrate from Segment to Server-side mParticle
Segment-to-mParticle Migration Reference
Rules Developer Guide
API Credential Management
The Developer's Guided Journey to mParticle
Create an Input
Start capturing data
Connect an Event Output
Create an Audience
Connect an Audience Output
Transform and Enhance Your Data
The new mParticle Experience
The Overview Map
Introduction
Data Retention
Connections
Activity
Live Stream
Data Filter
Rules
Tiered Events
mParticle Users and Roles
Analytics Free Trial
Troubleshooting mParticle
Usage metering for value-based pricing (VBP)
Introduction
Sync and Activate Analytics User Segments in mParticle
User Segment Activation
Welcome Page Announcements
Project Settings
Roles and Teammates
Organization Settings
Global Project Filters
Portfolio Analytics
Analytics Data Manager Overview
Events
Event Properties
User Properties
Revenue Mapping
Export Data
UTM Guide
Data Dictionary
Query Builder Overview
Modify Filters With And/Or Clauses
Query-time Sampling
Query Notes
Filter Where Clauses
Event vs. User Properties
Group By Clauses
Annotations
Cross-tool Compatibility
Apply All for Filter Where Clauses
Date Range and Time Settings Overview
Understanding the Screen View Event
Analyses Introduction
Getting Started
Visualization Options
For Clauses
Date Range and Time Settings
Calculator
Numerical Settings
Assisted Analysis
Properties Explorer
Frequency in Segmentation
Trends in Segmentation
Did [not] Perform Clauses
Cumulative vs. Non-Cumulative Analysis in Segmentation
Total Count of vs. Users Who Performed
Save Your Segmentation Analysis
Export Results in Segmentation
Explore Users from Segmentation
Getting Started with Funnels
Group By Settings
Conversion Window
Tracking Properties
Date Range and Time Settings
Visualization Options
Interpreting a Funnel Analysis
Group By
Filters
Conversion over Time
Conversion Order
Trends
Funnel Direction
Multi-path Funnels
Analyze as Cohort from Funnel
Save a Funnel Analysis
Explore Users from a Funnel
Export Results from a Funnel
Saved Analyses
Manage Analyses in Dashboards
Dashboards––Getting Started
Manage Dashboards
Dashboard Filters
Organize Dashboards
Scheduled Reports
Favorites
Time and Interval Settings in Dashboards
Query Notes in Dashboards
User Aliasing
The Demo Environment
Keyboard Shortcuts
Analytics for Marketers
Analytics for Product Managers
Compare Conversion Across Acquisition Sources
Analyze Product Feature Usage
Identify Points of User Friction
Time-based Subscription Analysis
Dashboard Tips and Tricks
Understand Product Stickiness
Optimize User Flow with A/B Testing
User Segments
IDSync Overview
Use Cases for IDSync
Components of IDSync
Store and Organize User Data
Identify Users
Default IDSync Configuration
Profile Conversion Strategy
Profile Link Strategy
Profile Isolation Strategy
Best Match Strategy
Aliasing
Overview
Create and Manage Group Definitions
Introduction
Catalog
Live Stream
Data Plans
Blocked Data Backfill Guide
Predictive Attributes Overview
Create Predictive Attributes
Assess and Troubleshoot Predictions
Use Predictive Attributes in Campaigns
Predictive Audiences Overview
Using Predictive Audiences
Introduction
Profiles
Warehouse Sync
Data Privacy Controls
Data Subject Requests
Default Service Limits
Feeds
Cross-Account Audience Sharing
Approved Sub-Processors
Import Data with CSV Files
CSV File Reference
Glossary
Video Index
Single Sign-On (SSO)
Setup Examples
Introduction
Introduction
Introduction
Rudderstack
Google Tag Manager
Segment
Advanced Data Warehouse Settings
AWS Kinesis (Snowplow)
AWS Redshift (Define Your Own Schema)
AWS S3 Integration (Define Your Own Schema)
AWS S3 (Snowplow Schema)
BigQuery (Snowplow Schema)
BigQuery Firebase Schema
BigQuery (Define Your Own Schema)
GCP BigQuery Export
Snowflake (Snowplow Schema)
Snowplow Schema Overview
Snowflake (Define Your Own Schema)
Aliasing
Event
Event
Audience
Audience
Feed
Event
Audience
Cookie Sync
Event
Audience
Audience
Audience
Event
Event
Feed
Event
Audience
Event
Data Warehouse
Event
Event
Event
Event
Audience
Event
Event
Event
Event
Event
Event
Audience
Event
Event
Feed
Event
Event
Audience
Feed
Event
Event
Event
Custom Feed
Data Warehouse
Event
Event
Audience
Audience
Audience
Audience
Event
Event
Event
Event
Event
Event
Audience
Audience
Event
Audience
Data Warehouse
Event
Event
Audience
Cookie Sync
Event
Event
Event
Event
Event
Feed
Feed
Event
Event
Event
Audience
Event
Event
Audience
Event
Event
Event
Feed
Audience
Event
Event
Audience
Audience
Event
Audience
Audience
Audience
Event
Audience
Event
Event
Event
Event
Feed
Event
Event
Event
Event
Event
Feed
Audience
Event
Event
Event
Feed
Event
Event
Event
Event
Event
Feed
Audience
Event
Event
Event
Event
Custom Pixel
Feed
Event
Event
Event
Audience
Event
Event
Data Warehouse
Event
Event
Audience
Audience
Audience
Event
Audience
Audience
Cookie Sync
Event
Audience
Feed
Audience
Event
Event
Audience
Audience
Event
Event
Event
Event
Audience
Cookie Sync
Cookie Sync
Audience
Audience
Feed
Shopify is an ecommerce platform that has everything you need to sell online, on social media, or in person. You can integrate Shopify with mParticle by using Custom Pixels.
Custom pixels help Shopify to collect customer events on their online store, such as the checkout and post-purchase pages. By using a Custom Pixel, you can log customer events to mParticle without having to modify your theme code.
Custom pixels are loaded in a Lax sandbox, designed for improved security and control over the data that is sent to third parties. As such, there are some limitations to using a Custom Pixel.
However, at this time, a Custom Pixel is the recommended way to integrate mParticle into your Shopify Theme.
Before you add a custom pixel, remove or modify any existing pixels to ensure customer events aren’t counted twice. Existing pixel code should be manually removed from any place it exists, including theme.liquid
, checkout.liquid
(Plus merchants only), and the Additional scripts section of your checkout settings.
Steps:
// Step 1. Initialize the JavaScript pixel SDK (make sure to exclude HTML)
, paste the mParticle Web SDK Snippet (without the <script>
tags) into the Shopify Code window.window.mParticle = {
config: {
isDevelopmentMode: true,
identifyRequest: {
userIdentities: {
email: 'email@example.com',
customerid: '123456',
},
},
identityCallback: function(result) {
// Do something once an identity call has been made.
// For more information, see https://docs.mparticle.com/developers/client-sdks/web/idsync/#sdk-initialization-and-identify
console.log(result);
},
dataPlan: {
planId: 'my_plan_id',
planVersion: 2
}
},
};
//load the SDK
(
function(t){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.3;window.mParticle.ready=function(t){window.mParticle.config.rq.push(t)};var e=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var o=["setCurrencyCode","logCheckout"];var i=["identify","login","logout","modify"];e.forEach(function(t){window.mParticle[t]=n(t)});o.forEach(function(t){window.mParticle.eCommerce[t]=n(t,"eCommerce")});i.forEach(function(t){window.mParticle.Identity[t]=n(t,"Identity")});function n(e,o){return function(){if(o){e=o+"."+e}var t=Array.prototype.slice.call(arguments);t.unshift(e);window.mParticle.config.rq.push(t)}}var dpId,dpV,config=window.mParticle.config,env=config.isDevelopmentMode?1:0,dbUrl="?env="+env,dataPlan=window.mParticle.config.dataPlan;dataPlan&&(dpId=dataPlan.planId,dpV=dataPlan.planVersion,dpId&&(dpV&&(dpV<1||dpV>1e3)&&(dpV=null),dbUrl+="&plan_id="+dpId+(dpV?"&plan_version="+dpV:"")));var mp=document.createElement("script");mp.type="text/javascript";mp.async=true;mp.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+t+"/mparticle.js" + dbUrl;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(mp,c)}
)("REPLACE WITH API KEY");
Update "REPLACE WITH API KEY"
with your mParticle API Key
identifyRequest
with any relevant configuration. Read SDK Initialization and Identify for more details// Step 2. Subscribe to customer events with analytics.subscribe(), and add tracking
, add specific customer event mappings (see below) underneath the Web SDK Snippet.At present, Shopify provides Standard Events and DOM Events that notify when a user completes a specific action on a Shopify Online Store. By subscribing to these events, you can map to an mParticle Event and log it.
For example, to track a page view:
analytics.subscribe('page_viewed', async (event) => {
window.mParticle.logPageView('Page View: ' + event.context.document.title, {
page: event.context.document.location.href,
title: event.context.document.title,
referrer: event.context.document.referrer,
});
});
Below is a list of our recommendations for how to map Shopify Events to mParticle Events. Please be aware that some of the event properties or options may differ based on your Shopify Store configuration.
Please view Shopify’s list of Standard Events for a complete list of event types that Shopify supports.
analytics.subscribe("cart_viewed", event => {
window.mParticle.ready(function () {
var products = [];
event.data.cart.lines.forEach(function (cartItem) {
var mpProduct = window.mParticle.eCommerce.createProduct(
cartItem.merchandise.product.title, // Name
cartItem.merchandise.sku, // SKU
cartItem.cost.totalAmount.amount, // Price
cartItem.quantity, // Quantity
cartItem.merchandise.title, // Variant
cartItem.merchandise.product.type, // Category
cartItem.merchandise.product.vendor, // Brand
);
products.push(mpProduct);
});
var transactionAttributes = {
Step: 1
};
window.mParticle.eCommerce.logProductAction(
window.mParticle.ProductActionType.Checkout, // Product Action Type
products, // Product(s)
undefined, // Custom Attributes
undefined, // Custom Flags
transactionAttributes // TransactionAttributes
);
});
});
analytics.subscribe("checkout_completed", event => {
window.mParticle.ready(function () {
var products = [];
event.data.checkout.lineItems.forEach(function (product) {
var mpProduct = window.mParticle.eCommerce.createProduct(
product.title, // Name
product.variant.sku, // SKU
product.finalLinePrice.amount, // Price
product.quantity, // Quantity
product.variant.title, // Variant
product.variant.product.type, // Category
product.variant.product.vendor, // Brand
);
products.push(mpProduct);
});
var checkoutTotalPrice = event.data.checkout.totalPrice.amount;
var transactionAttributes = {
Step: 3
Revenue: checkoutTotalPrice,
};
window.mParticle.eCommerce.logProductAction(
window.mParticle.ProductActionType.Checkout, // Product Action Type
products, // Product(s)
undefined, // Custom Attributes
undefined, // Custom Flags
transactionAttributes // TransactionAttributes
);
});
});
analytics.subscribe("checkout_started", event => {
window.mParticle.ready(function () {
var products = [];
event.data.checkout.lineItems.forEach(function (product) {
var mpProduct = window.mParticle.eCommerce.createProduct(
product.title, // Name
product.variant.sku, // SKU
product.finalLinePrice.amount, // Price
product.quantity, // Quantity
product.variant.title, // Variant
product.variant.product.type, // Category
product.variant.product.vendor, // Brand
);
products.push(mpProduct);
});
var transactionAttributes = {
Step: 2
};
window.mParticle.eCommerce.logProductAction(
window.mParticle.ProductActionType.Checkout, // Product Action Type
products, // Product(s)
undefined, // Custom Attributes
undefined, // Custom Flags
transactionAttributes // TransactionAttributes
);
});
});
analytics.subscribe("collection_viewed", event => {
window.mParticle.ready(function () {
var products = [];
event.data.collection.productVariants.forEach(function (product) {
var mpProduct = window.mParticle.eCommerce.createProduct(
product.title, // Name
product.sku, // SKU
product.price.amount, // Price
1, // Quantity
undefined, // Variant
product.product.type, // Category
product.product.vendor, // Brand
);
products.push(mpProduct);
});
var impression = window.mParticle.eCommerce.createImpression(
event.data.collection.title,
products
);
window.mParticle.eCommerce.logImpression(impression);
});
});
analytics.subscribe("page_viewed", event => {
window.mParticle.ready(function () {
window.mParticle.logPageView(
'Page View: ' + event.context.document.title,
{
page: event.context.document.location.href,
title: event.context.document.title,
referrer: event.context.document.referrer,
}
);
});
});
analytics.subscribe("product_added_to_cart", event => {
window.mParticle.ready(function () {
var product = window.mParticle.eCommerce.createProduct(
event.data.cartLine.merchandise.product.title, // Name
event.data.cartLine.merchandise.sku, // SKU
event.data.cartLine.merchandise.price.amount, // Price
event.data.cartLine.quantity, // Quantity
event.data.cartLine.merchandise.title, // Variant
event.data.cartLine.merchandise.type, // Category
event.data.cartLine.merchandise.vendor, // Brand
);
window.mParticle.eCommerce.logProductAction(
window.mParticle.ProductActionType.AddToCart,
product
);
});
});
analytics.subscribe("product_removed_from_cart", event => {
window.mParticle.ready(function () {
// We noticed that in some cases, the merchandise or product title comes back as undefined
var name = event.data.cartLine.merchandise.title || event.data.cartLine.merchandise.untranslatedTitle;
var product = window.mParticle.eCommerce.createProduct(
name, // Name
event.data.cartLine.merchandise.sku, // SKU
event.data.cartLine.merchandise.price.amount, // Price
event.data.cartLine.quantity, // Quantity
event.data.cartLine.merchandise.title, // Variant
event.data.cartLine.merchandise.type, // Category
event.data.cartLine.merchandise.vendor, // Brand
);
window.mParticle.eCommerce.logProductAction(
window.mParticle.ProductActionType.RemoveFromCart,
product
);
});
});
analytics.subscribe("product_viewed", event => {
console.log('subscribing to product viewed', event);
window.mParticle.ready(function () {
var product = window.mParticle.eCommerce.createProduct(
event.data.productVariant.title, // Name
event.data.productVariant.sku, // SKU
event.data.productVariant.price.amount, // Price
1, // Quantity
undefined, // Variant
event.data.productVariant.product.type, // Category
event.data.productVariant.product.vendor, // Brand
);
window.mParticle.eCommerce.logProductAction(
window.mParticle.ProductActionType.ViewDetail,
product
);
});
});