Skip to main content

Public Feedback Tab: How to pre-populate the reporter's email address

K
Written by Kriztin Abellon
Updated over 3 weeks ago

If you are using the public "Send Feedback" tab on your site and your site has logged-in users, you can pre-fill their email address for your best users when they send you feedback.

To achieve this, add some extra JavaScript code in your existing BugHerd embed code:

<script type="text/javascript">
var BugHerdConfig = {
"reporter": {
"email":"[email protected]",
"required":"true"
}
};

(function (d, t) {
var bh = d.createElement(t), s = d.getElementsByTagName(t)[0];
bh.type = 'text/javascript';
bh.src = '//www.bugherd.com/sidebarv2.js?apikey=YOUR-API-KEY-HERE';
s.parentNode.insertBefore(bh, s);
})(document, 'script');
</script>

Note: the "required" setting indicates whether the email field should be mandatory or not before filing a report.

In your server side code, substitute [email protected] with a directive to insert the current user's email address.

Did this answer your question?