Hello,
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
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="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> <param name="plugin-icon">images/pluginIcon.png</param> <param name="plugin-logo">images/pluginLogo.png</param> </plugin-info> <!-- add our web resources --> <web-resource key="piwik-resources" name="piwik Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="piwik.js" location="/js/piwik.js"/> <context>atl.admin</context> <context>atl.general</context> </web-resource> </atlassian-plugin>
In the piwik.js file, there is just the piwik javascript. Just build install it and It is ok !
Thanks for your help.
Hi, some extra info that worked for me.
In the piwik.js file I started placing exaclty what Piwik asks you to do:
<!-- Piwik --> <script type="text/javascript"> var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (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 ).
var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//YOUR_SERVER/"; ... ...
<noscript><p><img src="//YOUR_SERVER/piwik.php?idsite=5" style="border:0;" alt="" /></p></noscript>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for this help, I will try to do that and put here the result If I manage to get it working ! :)
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
<context>atl.admin</context>
<context>atl.general</context>
If you instead want it on particular pages, we have a list of contexts you can use in Stash.
Good luck!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.