Data passporting
When integrating an embedded service, there are often cases where you need to pass specific user-related or contextual data into the embedded application. The data_passport
parameter in the mmob SDK allows you to inject data that the embedded service can use to personalise the experience or tailor its functionality based on the provided values.
What is data passporting?
The data_passport
is an object that allows you to send key-value pairs into the embedded service. This enables the application to access specific user attributes, configuration settings, or any contextual information that should persist during the session.
Each key in data_passport
represents a field, and its value can be a string
, number
, or boolean
.
Example use case
Imagine you are embedding an insurance quote comparison service within your application. To streamline the process, you want to pre-fill certain user details so they don’t have to enter them manually.
By passing data into the embedded service, you can:
- Provide the user’s name and age to auto-populate form fields.
- Indicate whether they have previously consented to marketing preferences.
- Send an existing policy number so the service can retrieve relevant data.
Using data_passport
, the embedded service can recognise these values and use them to improve the user experience by reducing friction and speeding up interactions.
How data passporting works
Snippet generation and placeholder values
When an application has been built and data passporting has been configured, the application owner creates a deployment. As part of this process, a JavaScript snippet is generated, which is then shared with the application deployer.
This snippet contains everything necessary to initialise the application, including the data_passport
configuration if it has been defined. If data passporting is enabled, the generated snippet will automatically include the expected data_passport
keys with placeholder values formatted as
"{{YOUR-VALUE}}"
.
This ensures that the application deployer knows which data fields are required and can replace the placeholder values with actual user or session-specific data before integrating the application.
Example generated snippet
mmob.init({
deployer_id: "your-deployer-id",
integration_id: "your-integration-id",
location: "#app-container",
owner_id: "your-owner-id",
uid: "user-123456",
data_passport: {
first_name: "{{YOUR-VALUE}}",
last_name: "{{YOUR-VALUE}}",
age: "{{YOUR-VALUE}}",
marketing_opt_in: "{{YOUR-VALUE}}"
}
});
In this case, the application deployer must replace {{YOUR-VALUE}}
with real data before using the snippet in production. If a required value is missing or incorrectly mapped, the embedded service may not be able to use the provided data.
Predefined data passport configuration
The data sent through the data_passport
is assigned to a pre-configured data passport variable within the embedded application. For the data to be recognised and used, the keys in data_passport
must match the expected variable names inside the embedded application.
For example, if the embedded application expects a first_name
and age
field, but the deployer sends user_name
and years_old
, the data will not be recognised or used.
To ensure the correct data is passed:
- The application owner must define the expected
data_passport
keys within the application. - The application deployer must provide values that correctly match these keys.
If the provided data is valid and correctly mapped, the embedded service can then retrieve and use it as intended.
The data_passport
feature provides a structured way to pass relevant data into an embedded application, ensuring a seamless and personalised user experience. By correctly mapping values to predefined variables, application deployers can streamline user interactions, reduce friction, and improve efficiency within the embedded service.