I'm using the Jira "Issue Collector" plugin to collect feedback on Confluence pages.
Asked by Dave Drexler:

The embedded Javascript works fine in the global Custom HTML, but I'd like to make this space-specific.

I tried adding the Javascript to the Header and Footer sections in the Documentation Theme configuration, but no dice.

Any suggestions?


Answers:
author: Pavel Zubov
body: Hi, Dave!

You can create a custom feedback forum and submit requests from it via email using [Customer Case](https://marketplace.atlassian.com/plugins/customer-case-for-jira/cloud/overview) add-on for JIRA Cloud. In addition, you can also open the customer portal to your customers and users, so they can quickly browse the existing ideas and vote for them.

This will allow you to get a quick picture of your real customers' demands.   
You can learn the details here: <https://stiltsoft.customercase.com/forums/customer-case-for-jira/ideas/2800-add-support-for-widgets>


author: Martin Cleaver
body: How I did this is as follows:

New macro: x-issue-collector:

```
#### Developed by: My Name## Date created: dd/mm/yyyy## Installed by: My Name## @noparams
```

```
&lt;script type="text/javascript" src="http://yoursite/s/en_USodxtav/772/3/1.1/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=6d939084"&gt;&lt;/script&gt;&lt;/script&gt;
```

Then in the skin (we used RefinedWiki, so in their Space footer or anywhere similar that takes a macro):

{x-issue-collector}

comments: author: Robert Reiner _smartics_
body: Seems to work in the RefinedWiki **only if you are logged out**, while it works in the standard theme also when you are logged in (at least in our version/configuration).

Just in case someone is also trying to get the issue collector running - check if it works if you are not logged in ... :)


author: Robert Reiner _smartics_
body: Well, actually the feedback button was hidden behind the right toolbox. If the window is small enough that the toolbox is withdrawn, the feedback button gets into the view.

Since the toolbox is not shown for anonymous users I was mistaken to think that the login status has something to do with it: It does not.


author: Jesse Martinez
body: I found that wrapping the Issue Collector generated script with additional script tags helped the user macro get executed rather than rendered as html.


author: David at David Simpson Apps
body: If you're using the Documentation theme and having problems with the footer, why not create a user macro then embed that into the footer.

e.g. this user macro placed in the footer will manage to cause absolute annoyance:

```
&lt;script&gt;  alert(' +++++ $space.key $space.name +++++ ');&lt;/script&gt;
```

The javascript runs though, so it's a step forward for you. You can likely adapt it to your needs.

comments: author: Dave Drexler
body: Thanks, David! I'll give that a try.


author: Dave Drexler
body: Bummer... that approach didn't work, either. I tried wrapping the user macro in {html} macros, both in the user macro definition, and in the call to the user macro in the Doc Theme footer. I also tried the "Generates HTML" and "Generates Wiki Markup" user macro settings.

Nothing seems to run the script when the page renders.


author: Tom Moors
body: Hi Dave,

Can you check if the script is included in a correct script block, e.g.

```
<script type="text/javascript">//<![CDATA[-- your code here --//]]></script>
```

Would it be possible to paste your snippet?

An other way to make it work is to include it in the site-wide custom HTML (this works fine for me).

Regards,

Tom

comments: author: Dave Drexler
body: Hi Tom - when pasted into the Doc Theme's footer, the snippet shows up in the page source code like this:

```
&lt;div id="theme-footer"&gt;            script type="text/javascript" async src="http://10.38.160.150/s/en_US6rouvu/665/2/1.0.23-beta/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=1289abf5"&gt;&lt;/script&gt;        &lt;/div&gt;
```

It works fine in the site-wide custom HTML; what I'm trying to do is get space-specific snippets, so I can log issues into different Jira projects, based on space.


author: Adolfo Casari
body: Did you enable the [HTML macro](http://confluence.atlassian.com/display/DOC/Enabling+HTML+macros)??

comments: author: Dave Drexler
body: Yes. Embedded directly in a page, the Javascript snippet works fine when surrounded by the HTML macro.

In the Header or Footer customization fields in the Documentation Theme configuration, however, the Javascript just gets passed through to the rendered screen; it doesn't get run. Same results whether surrounded by the HTML macro or not.


author: Dave Drexler
body: Yes, the HTML macro is enabled.


author: SimonS
body: Hey Dave,

You could put the JavaScript in an HTML macro on a space. The user would have to navigate to that page to use the collector, but it could be specific to pages or spaces that way.

-Simon

comments: author: Dave Drexler
body: Thanks, Simon. We have 4 spaces in which we're particularly interested, and the spaces average 300 pages each. Adding the snippet per-page would be pretty tedious; I'm looking for a way to add a space-specific snippet to all the pages in each of those four spaces. The four spaces all use the Documentation theme, so I thought the footer customization would be perfect, but the Javascript doesn't get run - it just shows up in the footer as if it were text. I also tried wrapping the Javascript in {html} macros, to no avail.


Tags: issue-collector

jira