Technical integration
This article shows you how to integrate the data subject right request widget into a web page
Last updated
Was this helpful?
Was this helpful?
<div id="customer-subject-form-custom" ></div>
<button id="customer-request-button">Open the widget</button>
<script src="https://cdn.dastra.eu/sdk/dastra.js?key={YOUR PUBLIC KEY}" async></script>
<script>
window.dastra = window.dastra || [];
dastra.debug = true;
window.dastra.push(function(){
dastra.loadCustomerSubjectForm({
selector: '#customer-subject-form-custom',
widgetId: {your widget id},
onLoad: function (form) {
document.getElementById('customer-request-button').addEventListener('click',function () {
form.open()
})
}
})
})
</script><div id="customer-subject-popup" data-lang="it"></div><script>
// Set the user's family name
var familyName = 'Rossi'; // Replace with actual user's family name
// Set the user's given name
var givenName = 'Mario'; // Replace with actual user's given name
// Push user information to the DSR form widget
dastra.push(['set', 'dsr:familyName', familyName]);
dastra.push(['set', 'dsr:givenName', givenName]);
// Add more properties as needed, e.g., email, phone number
// dastra.push(['set', 'dsr:email', userEmail]);
// dastra.push(['set', 'dsr:phoneNumber', userPhoneNumber]);
</script><script>
// Read your custom userId (e.g. in session cookie)
var customerId = '{your custom userId}';
// Send the customerId to the DSR form widget
dastra.push(['set','dsr:refId', customerId ]);
</script><script>
var payload = {
customFieldSlug1: 'test',
customFieldSlug2: 'test'
};
// You can use this synthax for setting global custom fields as an object
dastra.push(['set','dsr:additionalDatas', payload]);
// Or directly for a single field, use the prefix @
dastra.push(['set','dsr:@customFieldSlug1', 'test']);
</script>https://api.dastra.eu/v1/client/customer-subject-form?id=<Your widget id>
&key=<your public key>
&dsr_email=test@github.org
&dsr_givenName=Dastonaute
&dsr_refId=123456
&...etc...