To configure MSPA in the InMobi CMP portal, see Portal Configuration and SDK Changes.
This section outlines the various APIs and callbacks that publishers can use to trigger the MSPA consent screen once they are integrated with GPP.
For more information on APIs that a CMP must support, as specified by IAB, see CMP API Specification.
This callback aims to know if the user has changed the location and retrigger the MSPA consent screen based on the new location.
Attribute | Data Type | Description |
locationChanged |
Boolean | Whether user has changed the location or not. |
previousLocation |
String |
Two letter region string like ca, va, ct, co, etc. |
currentLocation |
String |
Two letter region string like ca, va, ct, co, etc. |
window.__uspapi(isUserLocationChanged, 1, (result) => {
console.log(result); // { locationChanged: true, previousLocation: ‘va’, currentLocation: ‘ca’}
});
This will display the U.S Privacy UI (modal dialog). It will inherit style and style overrides given in the config object.
window.__uspapi('displayUspUi', 1, function(data, status) { console.log(data, status); })
The ping
command can be used to determine the state of the CMP. The callback shall be called with a PingReturn
object as the value of the data parameter. A value of false
will be passed as the argument to the success
parameter if the CMP fails to process this command.
Argument | Data Type | Value |
command |
String | "ping" |
callback |
function |
function (data: PingReturn, success: boolean) |
__gpp('ping', myFunction);
The addEventListener
command can be used to define a callback function that can be used to detect changes in the CMP. The callback shall be called with an EventListener
object immediately. The GPP script will then call the callback function and return a new EventListener object every time the CMP detects a change (see events below). A value of false
will be passed as the argument to the success
parameter if the CMP fails to process this command.
Argument | Data Type | Value |
command |
String | "addEventListener" |
callback |
function |
function (data: EventListener, success: boolean) |
__gpp('addEventListener', myFunction);
The removeEventListener
command can be used to remove an existing event listener. The callback shall be called with false
as the argument for the data
parameter if the listener could not be removed (e.g. the CMP cannot find a registered listener corresponding to listenerId
). A value of false
will be passed as the argument to the success
parameter if the CMP fails to process this command.
Argument | Data Type | Value |
command |
String | "removeEventListener" |
callback |
function |
function (data: boolean, success: boolean) |
parameter |
number | ID of the listenerId property that was returned from addEventListener command |
__gpp('removeEventListener', myFunction, listenerId);
The hasSection
command can be used to detect if the CMP has generated a section of a certain specification. The callback shall be called with true
as the argument for the data
parameter if the CMP has generated a section for the requested API prefix string. The data
parameter may be null
when the CMP is not yet loaded. A value of false
will be passed as the argument to the success
parameter if the CMP fails to process this command.
Argument | Data Type | Value |
command |
String | "hasSection" |
callback |
function |
function (data: boolean, success: boolean) |
parameter |
String | API Prefix string |
A client wants to ask the CMP if there is data for IAB TCF CA v1.0:
__gpp('hasSection', myFunction, "tcfcav1");
The getSection
command can be used to receive the (parsed) representation of a section of a certain specification. The callback shall be called with the (parsed) representation as the argument for the data parameter. The parsed representation of a section is an array of objects, where each object represents one sub-section of this section in the order that is given by the section specification. For example, the data parameter for the TCF Canada will be an array with one or two objects (Core sub-section plus optional publisher purposes sub-section). Each object is composed of the fields defined by the section specification.
The data parameter may be null
for sections that don't allow accessing the section data object outside an event handler. It may also be null
when the CMP is not yet loaded.
Argument | Data Type | Value |
command |
String | "getSection" |
callback |
function |
function (data: array of objects or null, success: boolean) |
parameter |
String | API Prefix string |
For example, client can ask the CMP to get the IAB TCF CA v1.0 TCData:
__gpp('getSection', myFunction, "tcfcav1");
Example value of data passed to the callback:
[
/* Core Sub-section */
{
Version:1,
Created: Date (Thu Apr 13 2023 18:07:12 GMT+0200),
LastUpdated: Date (Thu Apr 13 2023 18:07:12 GMT+0200),
CmpId: 31,
CmpVersion: 123,
ConsentScreen: 5,
...
},
/* Publisher Purposes Sub-section (optional) */
{
subsectionType:3,
PubPurposesExpressConsent : [1,2,3,4,5],
PubPurposesImpliedConsent : [6,7,8,9],
...
}
]
The getField
command can be used to receive a specific field out of a certain section. The callback shall be called with the value of the requested field as the argument for the data
parameter. The data
parameter may be null
for fields in sections that don't allow accessing the section data object outside an event handler. It may also be null
when the CMP is not yet loaded.
Argument | Data Type | Value |
command |
String | "getField" |
callback |
function |
function (data: mixed or null, success) |
parameter |
String | API Prefix string + "." (dot) + fieldname |
For example, a client can ask the CMP to get the last updated field from the IAB TCF CA v1.0 TCData.
__gpp('getField', myFunction, "tcfcav1.LastUpdated");
By installing this SDK update, you agree that your Children Privacy Compliance setting remains accurate or that you will update that setting, whenever there is a change in your app's audience. You may update the app's Children Privacy Compliance settings at https://publisher.inmobi.com/my-inventory/app-and-placements.