Common SDK Methods (External web form)
The purpose of the SDK is to provide the main functionality with minimal changes to existing web form interfaces. The SDK should be placed on the same page that the web form is collecting consent. Optionally, you can also place the SDK on any page that the data subject is directed to once they have submitted the web form.
The following methods and examples can be used as references when integrating the Collection Point SDK in your web form.
Intialized
This method can be used to ensure external settings are loaded and the SDK is initialized. All other public APIs will then be called after checking this Initialized flag.
Example Code:
Api.Initialized.then((response)=>{
console.log(response); // response is a boolean flag to know if sdk is intialized succesfully
});
GetPurposeLabels
This method can be used to get all the purpose labels for a given language.
Note: This is not supported for a multi-form Collection Point.
Example Request:
OneTrust.Api.GetPurposeLabels("fr");
Example Response Body:
[{
id: "{GUID}",
domId: "HTML attribute value used to find the checkbox on the page",
language: "language code of the label",
label: "Purpose label for a given language"
description: "Purpose description for a given language"
}]
GetPurposeLabel
This method can be used to get the purpose label for a given purpose and language.
Note: This is not supported for a multi-form Collection Point.
Example Request:
OneTrust.Api.GetPurposeLabel("{GUID}","{language}")
Example Response Body:
{
id: "{GUID}",
domId: "HTML attribute value used to find the checkbox on the page",
language: "language code of the label",
label: "Purpose label for a given language"
description: "Purpose description for a given language"
}
GetTopicLabels
This method can be used to get all the topic labels for a given language.
Note: This is not supported for a multi-form Collection Point.
Example Request:
OneTrust.Api.GetTopicLabels("fr");
Example Response Body:
[{
id: "{GUID}",
domId: "HTML attribute value used to find the checkbox on the page",
language: "language code of the label",
label: "Topic label for a given language"
}]
GetTopicLabel
This method can be used to get the topic label for a given topic and language.
Note: This is not supported for a multi-form Collection Point.
Example Request:
OneTrust.Api.GetTopicLabel("{GUID}","{language}")
Example Response Body:
{
id: "{GUID}",
domId: "HTML attribute value used to find the checkbox on the page",
language: "language code of the label",
label: "Topic label for a given language"
}
GetPurposeDefinitions
This method can be used to return the preferences object from the JSON.
Note: This is not supported for a multi-form Collection Point.
Example Request:
OneTrust.Api.GetPurposeDefinitions()
Response:
Refer Preferences from the collection point json
SetPurposeDefinitions
This method can be used to override the purpose definitions with custom values dynamically after the SDK is loaded. It can override a single/multiple property of a purpose or the entire purposes list.
Note: This is not supported for a multi-form Collection Point.
Example Code:
var customDefinitions = OneTrust.Api.GetPurposeDefinitions();
customDefinitions[0].identifierValues = "purpose1-modified";
OneTrust.Api.SetPurposeDefinitions(customDefinitions);
SetCustomPreferencesDefinitions
This method can be used to override custom preferences definition of a purpose. It can override a single/multiple property of a custom preference.
Note: This is not supported for a multi-form Collection Point.
Example Code:
OneTrust.Api.SetCustomPreferencesDefinitions(PURPOSE_ID, [{
identifierValues: 'customPreference1',
getOptionsValue
}]);
SetPurposeIdentifier
This method can be used to override a purpose identifier value property.
Note: This is not supported for a multi-form Collection Point.
Example Code:
OneTrust.Api.SetPurposeIdentifier("{GUID}", "purpose identifier value");
SetTopicIdentifier
This method can be used to override a topic identifier value property.
Note: This is not supported for a multi-form Collection Point.
Example Code:
OneTrust.Api.SetTopicIdentifier("{GUID}", "topic identifier value");
Updated 7 months ago