6 - Integrate with a Consent Management Platform (CMP)
X3M provides a mechanism for automating the integration with Google's User Messaging Platform. To enable this feature, set the flag isCMPAutomationEnabled
to true
:
export default function App() {
return (
<XMediatorProvider
appKey={"<YOUR_APP_KEY>"}
initSettings={{
consentInformation: {
isCMPAutomationEnabled: true,
},
}}
>
{/* your app code... */}
</XMediatorProvider>
);
}
This will prompt the user for consent only when required, and continue with the SDK initialization after the signals have been collected.
Display a Privacy Settings button inside your app
To give users the option to change their consent during the session, you may want to display a button in your app's settings when a form is available. X3M's SDK provides the following methods to achieve this:
if (isPrivacyFormAvailable()) {
showPrivacyForm().then((error) => {
if (error.code === undefined) {
console.log('[Demo App] Privacy form was shown without error');
} else {
console.log(
'[Demo App] Privacy form was not shown, error code:',
error.code,
', message:',
error.message
);
}
});
}
Debug your integration
When using the CMP Automation feature, you can debug your integration the following way:
export default function App() {
return (
<XMediatorProvider
appKey={"<YOUR_APP_KEY>"}
initSettings={{
consentInformation: {
isCMPAutomationEnabled: true,
// Configure a Debug Geography to trigger Privacy Form display
cmpDebugSettings: {
cmpDebugGeography: CMPDebugGeography.EEA, // Available options: Disabled, EEA and NotEEA
},
},
}}
>
{/* your app code... */}
</XMediatorProvider>
);
}
To reset the collected consent signals from the device: