How do I pass through name/email from my app to ProdPad?

The Customer Feedback Widgets emit and receive certain events to allow for programmatic interaction. There are many use-cases where this functionality might come in handy, though here we will just be discussing the scenario of pre filling widget form values.

These events are dispatched and listened for respectively for both the In-App Widget and the Portal Widget.

To target the portal widget, use the data attribute 'data-pp-cfpw-widget'

To target the in-app widget, use the data attribute 'data-pp-cfiw-widget'

 

Note that this code is targeting an ‘in-app’ widget.
 

var widget = document.querySelector('[data-pp-cfiw-widget]');

var setNameEvent = new CustomEvent('setNameValue', {

    'detail': 'Will'

});

var setEmailEvent = new CustomEvent('setEmailValue', {

    'detail': 'will@email.com'

});

widget.addEventListener('initialised', function(e) {

    widget.dispatchEvent(setNameEvent);

    widget.dispatchEvent(setEmailEvent);

});

 

Emitted Events

'Initialised' - This event will pass down the widget’s configuration as an object in the ‘detail’ property of the emitted event.

Listened For Events

'setNameValue' - This event expects the ‘detail’ property to be a string that it will apply as the value of the 'name' input in the widget’s form.

'setEmailValue' - This event expects the ‘detail’ property to be a string that it will apply as the value of the 'email' input in the widget’s form.

Have more questions? Submit a request

Comments