Enabling HTML Macro in Confluence OnDemand
Asked by JohnB:

I'm running a confluence OnDemand instance and I'd like to insert JavaScript into a page to insert a Google Chart.

My understanding is I need to enable the "HTML" Marco to allow me to insert raw HTML markup (like JavaScript).

However the "Enabling HTML macros" page mentions that it does not work with Confluence OnDemand:

<https://confluence.atlassian.com/display/DOC/Enabling+HTML+macros>

I cannot see any "HTML" Macros in my "Manage Plugins" page.

Am I doing it wrong? How can I get HTML into a page!?

Thanks,

Frustasted OnDemand User  
[](https://community.atlassian.com/t5/Confluence-questions/Enabling-HTML-Macro-in-Confluence-OnDemand/qaq-p/279945?attachment-id=3525){#link_118c75bc8a4336}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/156164/1/image2016-5-12%2014%3A22%3A51.png){#display_118c75bc8a4336_0}


Answers:
author: Tim
body: Hi John,

It's *many* years later now, but I thought it might still help you or others who stumble upon this question.

We've created a HTML macro as part of our toolbox of useful Confluence Cloud macros. It lets you securely embed any custom HTML and JS into any Confluence page or blog.

Try it here: <https://marketplace.atlassian.com/1215202>

Tim

comments: author: JohnB
body: image2016-5-12 14:22:51.png

It does seem like it works ![cheeky](/html/@FAF1B8ED81FE63CF2DF635B2383CF9FB/images/emoticons/cheeky.png "cheeky") -- Using the `HTML` macro I just threw in the Google Tag Manager code and used that to load GA (and anything else we want in the future)

Any ideas on:

* Retroactively adding a tag to all pages?
* Adding a specific macro so if we have to change the tag (I used Tag Managers to avoid this but it may come up)
* Setting it up so its added by default to all new pages?


author: JohnB
body: Oh, also, thanks ![laugh](/html/@BEA1CC333F4D830F5303329D7DC07DE4/images/emoticons/laugh.png "laugh")


author: Tim
body: > Retroactively adding a tag to all pages?  
> Setting it up so its added by default to all new pages?

I've done some digging through the docs and web and with Cloud I haven't yet found any easy ways to retroactively add a macro to multiple pages or make it a default for new pages. Potentially could use a page template but you'd have to remember to select it when you create a page which isn't ideal.
> Adding a specific macro...

A macro specifically for GTM could be a possibility. Out of interest, are you using Tag Manager + GA to help measure your team's engagement in Confluence?


author: Nar Kumar C. - Narva Software
body: FYI company behind Macro Toolbox was acquired by Atlassian and they decided to discontinue this app (including HTML Macro).

As an alternative option, you can use our app [HTML Macro for Confluence](https://marketplace.atlassian.com/apps/1221472/html-macro-for-confluence?hosting=cloud&tab=overview)

available in Marketplace.


author: TJ Baker
body: How about allowing the addition of HTML or Javascript from your own system at least, so we can embed a JIRA Issue Collector?


author: SimonS
body: Hey John,

Fraid' it isn't possible to use the HTML macro in Confluence OnDemand, or anywhere in OnDemand for that matter.

When you allow JavaScript, it opens up a bunch of security risks that we didn't want to take with OnDemand. So, we removed it and added it to the restricted functions list:

<http://confluence.atlassian.com/display/AOD/Restricted+Functions+in+Atlassian+OnDemand>

Sorry for the bad news :( it's very likely to remain restricted.

-Simon

comments: author: JohnB
body: Bummer! Guess I'll just link out to an HTML page where we'll host the chart.

Thanks Simon!


author: SimonD
body: Hi Simon,

How about allowing the HTML Macro but with scripting disabled for on demand? I would like to include a lot of swf with some custom parameters but the way it looks right now I will have to make (and maintain) a custom html for each individual include, which would result in alot of work.

Is there any other way how I could pass a parameter to an swf from within confluence? Thanks a lot in advance!

Sample code:

<br />

\<embed src="some.swf?file=../somefile.xml\&amp;mode=view\&amp;width=600\&amp;height=300" width="600x" height="300px"\>

Best,

//Simon


author: Tim
body: Simon: we've created a HTML macro for Cloud that could help embed SWF's with custom parameters. You can give it a try here: <https://marketplace.atlassian.com/1215202>. Hope it helps :smile:


author: herbert serrano
body: What about using Google Charts API and embedding it into the HTML macro, see: [theessayservice](https://theessayservice.org/).


author: James Dellow
body: You can now use [Atlassian Connect](https://www.youtube.com/watch?v=rAskTn5ymJA "Introducing Atlassian Connect") to work around this security restriction in Confluence OnDemand. You can build private add-ons that create simple macros that allow you to insert custom HTML into a page.

comments: author: Alexandre Tumlinson
body: Would you expect it would be possible to use this to enable the bit of html insert necessary for Google Analytics?


author: JohnB
body: @Andres - <https://answers.atlassian.com/questions/71174/how-to-use-iframes-in-confluence-pages>


author: Andres Rodriguez
body: John, could you tell me how to include an IFRAME into a Confluence Page? Thanks.

comments: author: JohnB
body: <https://answers.atlassian.com/questions/71174/how-to-use-iframes-in-confluence-pages>


author: JohnB
body: I ended up working around this issue using an iframe - I inserted the Google Charts JS into an HTML page and then just included that in the iframe.


Tags: cloud

confluence-cloud