The BugHerd sidebar can be configured to override some of its default behaviour as well as display extra information in any tasks that you pass in from a configuration object called BugHerdConfig
.
When setting up BugHerd for the first time, you probably already know you need to add the following code to your site:
<script type="text/javascript">
(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>
The BugHerdConfig
object is added to the initilisation script as shown below:
<script type="text/javascript">
var BugHerdConfig = {
// META DATA
metadata: {
username: "foobar",
version: "1.0",
foo: "bar",
logged_in: "true"
}
};
// BUGHERD INITIALISATION
(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>
Adding custom meta data to the "Additional Info" area for tasks created on your site is just a matter of adding an object called metadata
to the BugHerdConfig
object within the initialisation script.
The metadata
object is comprised of simple key/value pairs.
var BugHerdConfig = {
// META DATA
metadata: {
username: "foobar",
version: "1.0",
foo: "bar",
logged_in: "true"
}
};
Note: the values are strings. If you want to pass in true
as above, send it as the string "true"
.