Pre-populate reporter email address on Send Feedback

Follow

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":"someone@example.com",
      "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>

 

In your server side code, substitute someone@example.com with a directive to insert the current user's email address.

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

Have more questions? Submit a request

Comments

  • Avatar
    Stuart Eggleston

    This is brilliant!!!

    Is there a list of other variables like this one? For example, hiding the option to download the browser extension after posting feedback or changing the copy on the panels?

  • Avatar
    Vincent Brendel

    Hi Stuart, sorry we don't have that yet. But we do get that request more often and it's something we're considering to add. Thanks very much for sharing your feedback!

  • Avatar
    Vincent Brendel

    Sorry Stuart, also to your other point: here is a more complete article on what's currently possible with the feedback widget:

    http://blog.bugherd.com/everything-you-always-wanted-to-know-about-our-feedback-widget-but-were-afraid-to-ask/

    We'll be documenting each feature in more detail in the How To forum as well soon.

  • Avatar
    Phill Price

    Not sure why but this fails in Safari 6 on a mac? I've even used the email above rather than one from our system and it says there's an unexpected } hmm

  • Avatar
    Vincent Brendel

    Hi Phil, sorry I could not reproduce that issue with Safari 6 as yet. Would you kindly send the website URL or code snippet you use to support@bugherd.com and we'll figure out the problem. Thanks in advance!

  • Avatar
    David L

    The "unexpected }" issue is not Safari specific, it's because there is a bug in the code above.

    "reporter": //this is where you're missing {

    "email":"someone@example.com",

    "required":"true"

    }

     

    Missing the open { after required causes it to not be treated as an array, and thus fails to load.  After putting the code into our own site, noticed it didn't work at all, and this is why.

  • Avatar
    Vincent Brendel

    David, great pickup, thank you!! It's been corrected in the main post.

    Apologies also to Phil, the problem you had was my fault and I didn't realise.

Powered by Zendesk