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
Custom Access Roles API
Bulk Profile Deletion API Reference
Data Planning API
Group Identity API Reference
Calculated Attributes Seeding API
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
Configuration
Content Security Policy
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
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
Data Hosting Locations
Glossary
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
Accelerated Mobile Pages (AMP) is a way to build web pages for static content that render fast. AMP includes an amp-analytics
element that allows you to track user interactions with AMP pages. To learn more about analytics for AMP pages see the amp-analytics reference. For general information about AMP see What Is AMP? on the Accelerated Mobile Pages (AMP) Project site.
amp-analytics
is an extended component and must be explicitly included into the document as a custom element to use it. To add AMP analytics functionality to your page:
Include this script in the <head>
, before the AMP JS library:
<script async custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<amp-analytics type="mparticle" id="analytics1">
...
</amp-analytics>
amp-analytics
element to the body of your page and set the type attribute of the amp-analytics
element to mparticle
. id
attribute so that you can easily identify each amp-analytics
element (e.g. debugging).The following trigger request values are supported for the mParticle configuration:
Page tracking allows you to measure the number of views you had for a particular page on your website. Pageview hits can be sent by setting the trigger request
value to pageview
.
<amp-analytics type="mparticle" id="analytics1">
<script type="application/json">
{
"vars": {
"apiKey": "Your mParticle API Key"
"pageName": "Your custom page name"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
}
}
}
</script>
</amp-analytics>
You can set key-value pairs for the following pageview fields in the vars attribute of the trigger.
Value | Default Value | Required | Description |
---|---|---|---|
title | Defaults to title | no | The title of the page. |
ampdocUrl | Defaults to ampdocUrl | no | URL of the page being tracked. |
pageName | no | Allows you to set up a custom name for your page, separate from that of title. |
The following example overrides the default pageview values for title and ampdocUrl:
<amp-analytics type="mparticle" id="analytics2">
<script type="application/json">
{
"vars": {
"apiKey": "Your mParticle API Key"
},
"triggers": {
"trackPageviewWithAmpdocUrl": {
"on": "visible",
"request": "pageview",
"vars": {
"title": "Custom Title",
"ampdocUrl": "http://www.example.com"
}
}
}
}
</script>
</amp-analytics>
Events are user interactions with content that can be tracked independently from a web page or a screen load. Event hits can be sent by setting the trigger request
value to event
and providing additional event properties.
The following example uses the selector
attribute of the trigger to send an event when a particular element is clicked.
<amp-analytics type="mparticle" id="analytics3">
<script type="application/json">
{
"vars": {
"apiKey": "AppKey"
},
"triggers": {
"trackAppEvent": {
"on": "click",
"selector": "#test1",
"request": "event",
"vars": {
"eventName": "AMP Test 1 button clicked",
"eventType": "Unknown",
"eventAttributes_Keys": ["test key1","test key2"],
"eventAttributes_Values": ["test value1","test value2"],
"userAttributes_Keys": ["test user attr key1","test user attr key2"],
"userAttributes_Values": ["test user attr value1","test user attr value2"],
"userIdentities_Types" : ["facebook", "twitter"],
"userIdentities_Values" : ["example@facebook.com", "@example"],
"debug": "true",
"location": [26.4619396, -80.0691996],
"customFlags_Keys": ["custom flag1", "custom flag2"],
"customFlags_Values": ["[100, 200]", "[test val1, test val2]"],
"appVersion": "1.0"
},
"extraUrlParams": {
"consent_state": {
...
}
}
}
}
}
</script>
</amp-analytics>
You can set key-value pairs for the following event fields in the vars attribute of the trigger.
Value | Default Value | Required | Description |
---|---|---|---|
eventName | no | The name of the event. | |
eventType | “Unknown” | no | The type of event. The supported event types are listed here. |
eventAttributes_Keys | no | An array of event attribute keys. | |
eventAttributes_Values | no | An array of event attribute values, corresponding to the eventAttributes_Keys. Encode before sending to the server. | |
userAttributes_Keys | no | An array of user attribute keys. | |
userAttributes_Values | no | An array of user attribute values, corresponding to the userAttributes_Keys. Encode before sending to the server. | |
userIdentities_Types | no | An array of user identities. | |
userIdentities_Values | no | An array of user identity values, corresponding to the userIdentities_Types. | |
debug | “false” | no | Set the debug flag to “true” to indicate development data or to “false” to indicate production data. |
location | no | The location where the event occurred represented as [lat,long] | |
customFlags_Keys | no | An array of custom flags. | |
customFlags_Values | no | An array of custom flag values, corresponding to the customFlags_Keys. Encode before sending to the server. | |
appVersion | no | Your application version. |
You can send consent state data in the optional extraUrlParams
property of the trigger.
"extraUrlParams": {
"consent_state": {
"gdpr": {
"location_collection": {
"consented": true,
"document": "location_collection_agreement_v4",
"timestamp_unixtime_ms": "${timestamp}",
"location": "17 Cherry Tree Lane",
"hardware_id": "IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702"
},
"parental": {
"consented": false,
"document": "parental_consent_agreement_v2",
"timestamp_unixtime_ms": "${timestamp}",
"location": "17 Cherry Tree Lane",
"hardware_id": "IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702"
}
},
"ccpa":{
"data_sale_opt_out":{
"consented": true,
"document": null,
"timestamp_unixtime_ms": "${timestamp}",
"location": null,
"hardware_id": null
}
}
}
}
The consent_state
object accepts two types of regulations: gdpr
and ccpa
.
Both the gdpr
and ccpa
objects have the same signature as a key-value mapping between purpose
and consent data
.
For GDPR, the purpose
object in the above example is shown as location_collection
and parental
, but should be named according to your needs. For CCPA, the purpose
is always data_sale_opt_out
.
Value | Data Type | Required | Example Value(s) | Description |
---|---|---|---|---|
document | string |
no | "v23.2b" |
An identifier for the document, document version, or experience that the user may have consented to. |
consented | bool |
yes | true / false |
The user’s decision on a prompted consent purpose. If the user agreed: true . If the user rejected: false . |
timestamp_unixtime_ms | number |
yes | 1510949166 , "${timestamp}" * |
The timestamp (Unix time) representing when the consent data was created. *${timestamp} is a special amp-analytics variable. |
location | string |
no | "example.com" , "123 My Street" |
The location where the user gave consent. This property exists only to provide additional context. It may be a physical or digital location. |
hardware_id | string |
no | "IDFA:a5d934n0-232f-4afc-2e9a-3832d95zc702" |
A hardware ID for the device or browser used to give consent. This property exists only to provide additional context and is not used to identify users. |
Was this page helpful?