Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Where to place Matomo script in Bitbucket?

Timothy Ryner
Contributor
March 2, 2022

We're using Matomo for web monitoring and metrics reporting. The tool requires a relatively simple script to be applied to all pages, which gathers some traffic data and sends it to a Matomo instance.


Looking for recommendations on where to place such a script in Bitbucket. In Jira and Confluence, we've been able to leverage the Announcement Banner and Custom HTML configs to run the script. But since Bitbucket uses markdown for the announcement banner, I don't have the same front end options.
Recommendations on where a script could be placed in order to run for all pages.


Example Matomo script:
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{$MATOMO_URL}/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', {$IDSITE}]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->

1 answer

0 votes
Timothy Ryner
Contributor
March 3, 2022

I was able to put it onto the login screen, since we're running the Resolutions SAML SSO plugin, and I can edit the login page template to run the script.  But obviously, that only runs on one page, and no other pages after that.

Fiddled around, inserted the script into the configurations for the announcement-banner.soy, aui.soy, and other similar files.  Errors on startup that the soy files couldn't compile or something.  It was worth a try.  

Open to suggestions on possible locations to wedge a script into the global page configs. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events