Data plans allow you to describe the type and format of the data you expect to collect in your app. mParticle compares incoming data to a data plan, preventing any data that does not match the plan from being stored in your account or forwarded to your outputs.
You can create multiple data plans in each workspace of your account, and each plan can have multiple versions.
Data plans are created from two main elements:
Use the following steps to create a basic data plan using a template in the mParticle UI.
Data plans can be created from templates in the mParticle UI, they can be created using the Data Plan Builder, or they can be created by importing actual event data collected from your app.
For this tutorial, use the sample data plan that has been built for the Higgs Shop specifically. The steps below explain where to find the sample data plan, how to upload it to your mParticle account, activate it, and then make sure that data from your instance of the sample app is being validated against the plan.
mparticle-apple-sample-apps/core-sdk-samples/higgs-shop-sample-app/dataplans/higgs_shop_basic_data_plan_1.jsonin the directory where you cloned the sample app repo.
Plan Idwhich you will need later.
mParticle displays a detailed view of the data plan based on the JSON file you uploaded.
For each event in the list, you can see the event category, event name, and event description mParticle will expect to receive from your app. Events that include additional attributes can be expanded by clicking the + icon next to the event category.
When you begin collecting production data, you will need to change your plan’s status from Active on Dev to Active on Prod/Dev.
AppDelegate.swift. This is the same file we use to initialize the mParticle SDK.
MParticleOptionsobject, include the data plan ID and version with:
options.dataPlanId = "your_plan_name" // Always undercase with white space replaced with '_' options.dataPlanVersion = 1
your_plan_namewith your Plan Id referenced earlier when creating a data plan.
planVersionis set to the correct version of your plan. If you kept the default settings in step 7.1, this should be
Learn more about data plans and data validation in Data Planning.
Was this page helpful?