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
The mParticle SDK automatically monitors the “application state” of your app and forwards data to mParticle via a dedicated event type called Application State Transition (AST). Each AST event includes a transition_type
property, describing the state change.
The transition types for the iOS SDK are:
application_initialized
: The application has been opened by the user.application_background
: The user has moved the app to background, but it is still open.application_foreground
: The user has brought the app back to the foreground.One of the main uses of AST events is to track when a user installs or upgrades your app. Each output integration handles app installation tracking differently: some partners simply infer that the app was installed when they first begin to receive data with a Device ID that hasn’t been seen previously while others receive a specific install
event.
AST events with type application_initialized
include two boolean properties to help track installs:
is_first_run
is_upgrade
mParticle uses these properties to determine how to forward AST events to your connected outputs.
By default, the is_first_run
and is_upgrade
properties discussed above are automatically detected and set by mParticle.
However, if you have your own criteria you want to use to define installs and upgrades, you can manually set the “install type” in the MParticleOptions
object when you initialize the SDK.
The install type options are:
MPInstallationType.knownInstall
MPInstallationType.knownUpgrade
MPInstallationType.knownSameVersion
MPInstallationType.autodetect
(default)MParticleOptions *options = [MParticleOptions optionsWithKey:@"REPLACE WITH APP KEY" secret:@"REPLACE WITH APP SECRET"];
options.installType = MPInstallationTypeKnownInstall;
[[MParticle sharedInstance] startWithOptions:options];
let options = MParticleOptions(key: "REPLACE WITH APP KEY", secret: "REPLACE WITH APP SECRET")
options.installType = .knownInstall
MParticle.sharedInstance().start(with: options)
ASTs with type application_initialized
have a successfully closed
parameter which tracks whether the previous user session was successfully closed. This parameter helps mParticle to successfully record sessions when users force quit the app. See Force Quit for more.
The mParticle platform tracks user sessions. Sessions track a common pattern, in which a given user opens an app and interacts with it for a period of time, then moves on to another app, or stops using their device. Various output integrations use sessions to group user interactions. All events tracked during a session will also share a Session ID. The mParticle platform translates the sessions it detects into a consumable format for each output.
The mParticle iOS SDK provides APIs to allow you to customize the measurement of sessions.
When a user launches your app, the mParticle SDK will begin a new session. This session is maintained for as long as your app is in the foreground and all events logged during this time will be associated with the session.
If a user navigates away, or sends your app to the background, the SDK starts a timer to expire the current session. If the user brings your app back to the foreground before the session times out, the same session is continued. Otherwise, the session will expire and a new session will begin the next time the app is used.
By default, the session timeout is 60 seconds, but can be customized with a minimum timeout of 1 second and no maximum.
//Set the session timeout in seconds up to a max of 120
[MParticle sharedInstance].sessionTimeout = 60;
If an application is allowed to continue running in the background for long periods of time, such as media playing or recording, and map based applications, the current session will expire based on the session timeout even if the media or maps operations are still active. If you need the background activity to be included in the user’s session length, you can disable automatic tracking and manually start/end sessions.
//Disable automatic tracking
MParticleOptions *options = [MParticleOptions optionsWithKey:@"foo-key" secret:@"foo-secret"];
options.automaticSessionTracking = NO;
[[MParticle sharedInstance] startWithOptions:options];
//Manually begin or end a session
[[MParticle sharedInstance] beginSession];
[[MParticle sharedInstance] endSession];
We’ve observed a common pattern where users launch an app, interact with it, and then forcibly terminate the app, rather than allowing it to remain in the background. The mParticle SDK handles this situation gracefully.
When an app is terminated before a session had the chance to end itself, the SDK will end that session and start a new one the next time the app is launched.
The SDK logs when an app is launched, sent to the background, resumed to the foreground, and/or terminated. Those state transitions are not only sent to the server, but also they help to identify user sessions.
You can register to receive notifications from the mParticle SDK when a new session begins or when the current session is about to end. The registration is done in the NSNotificationCenter
using the mParticleSessionDidBeginNotification
and mParticleSessionDidEndNotification
name constants. The notifications contain a userInfo dictionary containing the Session ID. You can access its value by using the mParticleSessionId
key constant.
- (void)registerForSessionNotifications {
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self
selector:@selector(handleSessionDidBegin:)
name:mParticleSessionDidBeginNotification
object:nil];
[notificationCenter addObserver:self
selector:@selector(handleSessionDidEnd:)
name:mParticleSessionDidEndNotification
object:nil];
}
- (void)handleSessionDidBegin:(NSNotification *)notification {
NSDictionary *userInfo = [notification userInfo];
NSLog(@"New session has begun. Id: %@", userInfo[mParticleSessionId]);
}
- (void)handleSessionDidEnd:(NSNotification *)notification {
NSDictionary *userInfo = [notification userInfo];
NSLog(@"Session id %@ will end.", userInfo[mParticleSessionId]);
}
If you use embedded kits, keep in mind that most kits perform their own session and install tracking, independently of mParticle. While it is impossible to guarantee that session times will match between mParticle and a kit partner, you can sometimes tweak the kit settings to help sessions line up. For example, the Braze kit provides a session timeout setting that works similarly to mParticle’s own, and you may wish to set it to match your mParticle session timeout.
Was this page helpful?