0

I'm trying to add BugHerd (an issue tracking tool) to my Magento 2.1 project, which requires I add the following script into the <head> tag:

<script type='text/javascript'>
 (function (d, t) {
 var bh = d.createElement(t), s = d.getElementsByTagName(t)[0];
 bh.type = 'text/javascript';
 bh.src = 'https://www.bugherd.com/sidebarv2.js?apikey={my api key}';
 s.parentNode.insertBefore(bh, s);
 })(document, 'script');
</script>

There are many questions on this topic referencing old Magento versions, but I can't seem to find an updated answer. Any ideas?

Thanks!

asked Mar 3, 2017 at 23:21

2 Answers 2

1

Hi you can also use the backend of magento 2 website.

Just add the bugherd JS code in Content>Design>Configuration>"Your Current Store" and just like the picture insert your JS code there and save.

I hope this helps.

enter image description here

answered Mar 6, 2017 at 2:03
1
  • No problem, You're welcome. Commented Mar 7, 2017 at 1:29
0

In your theme's directory, create this file: {theme_dir}/Magento_Theme/layout/default.xml with the following:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <head>
 <script src="js/bugherd.js"/>
 </head>
</page>

Then you put the bugherd.js file in {theme_dir}/web/js/bugherd.js

answered Mar 4, 2017 at 0:04
1
  • This worked for me! Thanks for your quick response. Commented Mar 4, 2017 at 1:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.