Feedback Widget
How to initialize and use the feedback widget

Initializing the feedback widget

Finally, after you've installed the widget SDK you have to invoke the "ProdCamp" init function to identify a user in your system that will be matched to a Customer Contact in ProdCamp (so you don't have to create a contact for every user via API manually - it will be created automatically based on the data that you provide in the init function. When a user sends feedback for the first time - a contact entity will be created or the feedback will be matched to an existing one compared by the provided email)
1
<script>
2
ProdCamp('initFeedbackWidget', {
3
4
company: {
5
name: 'Foo',
6
revenue: 100
7
},
8
firstName: 'John',
9
lastName: 'Doe',
10
avatarUrl: 'https://somedomain.com/avatar.png'
11
});
12
</script>
Copied!
We strongly recommend you use the SSO token for your security to authorize requests from your widgets and prevent irrelevant data (spam) as well as unauthorized access. Learn how to set it up here.
For instance: if you set up the SSO token - you don't need to provide any initialization parameters to the widget, because it's already provided inside the token. If the data provided inside the initialization parameters doesn't match the one used inside the token - it will be just ignored by our servers and the one from the token will be used instead, anyway.
So, after setting up the token - you will have to just invoke the initialization function like in the following code and it will be enough:
1
ProdCamp('initFeedbackWidget')
Copied!
The only situation when an email should be provided in both cases - is when you set up the async getToken function to receive a new token each time user performs an action. Because before the user performs the first action - there will be no info regarding the user and the widget will show an "Email" field to be filled up by the user himself (which will actually be ignored after the token is received).
Those are the fields that you can provide in the init function:
  • email
  • company
    • name
    • revenue
  • firstName
  • lastName
  • avatarUrl
The "email" field is the only required one and will be used as an identifier to create a new contact or match the provided feedback to an existing one.
The "company" property will be used to identify a Customer Account that the contact belongs to (if a Customer Account with such name exists - contact will be bound to this account, in other cases, a new Customer Account will be created with the name that was provided in the "name" field of the company property). When you provide a revenue field - it will update the Revenue field inside the provided account if it exists or set the revenue value in the newly created one.
If the "company" property is not provided - contact will be created along with a new customer account that will have the name same as the domain of the email provided in the init function if the domain is not of commonly used email services like "Google," "Hotmail," etc. Or the new account will not be created, but the contact will be bound to the "No Account" special customer account that exists in your ProdCamp from the start and collects all the contacts that can't be identified by their emails.

Feedback widget commands

There are several commands that you can use to manipulate the feedback widget behavior
  • initFeedbackWidget - this one you already know and it instantiates a feedback widget.
  • openFeedbackWidget - this command can be used to open the widget manually from anywhere in your code
  • closeFeedbackWidget - this command will respectively close the widget
  • updateFeedbackWidgetUser - using this command you can update the user that will be sent along with the next provided feedback. The format of the model that should be provided is the same as in the first init command. Just like the following code:
1
<script>
2
ProdCamp('updateFeedbackWidgetUser', {
3
4
company: {
5
name: 'Foo',
6
revenue: 100
7
},
8
firstName: 'John',
9
lastName: 'Doe',
10
avatarUrl: 'https://somedomain.com/avatar.png'
11
});
12
</script>
Copied!
  • destroyFeedbackWidget - destroy the widget instance on the page
Last modified 2mo ago