Script for analytics (Matomo)

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
ajturnersurrey
Sr. Propeller Head
Posts: 346
Joined: Fri Nov 05, 2010 3:30 am

Script for analytics (Matomo)

Post by ajturnersurrey »

I am struggling with the way that Flare messes with scripts as side nav help is compiled.

I see I have several options to insert scripts - in the topic head/body, in the master page head, or in the target Advanced tab for Add content to head.
These all seem to lead to different results in the compiled help topics and none of them is the same as just pasting the script into the compiled topics (which I'd really like to avoid).

For this reason, with my own very limited scripts, I have always pasted them into the body of topics - to minimise Flare build effects.

But my dev has given me code he'd like to appear in the head of each page looks a bit like this:

Code: Select all

<script type="text/javascript">
  var _paq = window._paq = window._paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="...website address...";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '...id...']);
    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>
<noscript><p><img src="...other website address...?idsite=6&amp;rec=1" style="border:0;" alt="" /></p></noscript>
(This mostly agrees with what I looked up on https://developer.matomo.org/guides/tra ... ript-guide - so I know the dev hasn't added anything terribly unusual to this script other than the <noscript> section)

So my question is - can people more familiar with scripts than me see anything about this script that is particularly prone to upset Flare? Any recommendations about where best to insert the code so that I can do it in Flare rather than post build, without it getting mangled by the build?
Post Reply