Integrate Piwik on Stash


I would like to integrate Piwik javascript code in my Stash instance but I do not know what is the best solution to do it.

For exemple in JIRA I have used the "Announcment Banner" which indeed adds the javascript code on each page but how could I do similar thing for Stash application ?

Any idea?

Thanks for your help

4 answers

1 accepted

This widget could not be displayed.

Finally I had time to work on it :)

It was indeed really simple, here the atlassian-plugin.xml configuration file:

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${}" plugins-version="2">
        <vendor name="${}" url="${project.organization.url}" />
        <param name="plugin-icon">images/pluginIcon.png</param>
        <param name="plugin-logo">images/pluginLogo.png</param>

    <!-- add our web resources -->
    <web-resource key="piwik-resources" name="piwik Web Resources">
        <resource type="download" name="piwik.js" location="/js/piwik.js"/>

In the piwik.js file, there is just the piwik javascript. Just build install it and It is ok !

Thanks for your help.

This widget could not be displayed.
Adam Ahmed Atlassian Team Dec 11, 2013

You need to write a plugin.

There is a kind of module you can add to a plugin called a Web Resource. You can use that to define JS and CSS that you want to add. Using a <context> within that web resource you can define which pages that JS appears on. If you actually do want it to be on every single page, you can use two contexts:


If you instead want it on particular pages, we have a list of contexts you can use in Stash.

Good luck!

This widget could not be displayed.

Thanks for this help, I will try to do that and put here the result If I manage to get it working ! :)


This widget could not be displayed.

Hi, some extra info that worked for me.

In the piwik.js file I started placing exaclty what Piwik asks you to do:

&lt;!-- Piwik --&gt;
&lt;script type="text/javascript"&gt;
  var _paq = _paq || [];
  (function() {
    var u="//YOUR_SERVER/";

That did not work for me. I had to remove the HTML stuff and leave just the javascript code (obvious smile).

var _paq = _paq || [];
  (function() {
    var u="//YOUR_SERVER/";
I did not include the last part proposed by Piwik and seems to be fine:
&lt;noscript&gt;&lt;p&gt;&lt;img src="//YOUR_SERVER/piwik.php?idsite=5" style="border:0;" alt="" /&gt;&lt;/p&gt;&lt;/noscript&gt;




Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 7 hours ago in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

25 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you