Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74700

[matomo-analytics] Extract inline script block in io/jenkins/plugins/matomoanalytics/MatomoPageDecorator/footer.jelly

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • _unsorted

      Problem

      == Inline Script Block
      Line: 6
      ----
      <script>
                      var _paq = window._paq = window._paq || [];
                      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
                      _paq.push(['trackPageView']);
                      _paq.push(['enableLinkTracking']);
                      var d = document;
                      if ("${it.matomoSendUserID}") {
                          var userID, userIDNode, Nodes = d.getElementsByClassName('hidden-xs hidden-sm');
                          if (Nodes !== undefined) {
                              _paq.push(['setUserId', Nodes[0].textContent]);
                          }
                      }
                      (function () {
                          var u = "${it.protocolString}${it.matomoServer}${it.matomoPath}";
                          _paq.push(['setTrackerUrl', u + 'matomo.php']);
                          _paq.push(['setSiteId', ${it.matomoSiteID}]);
                          var g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
                          g.async = true;
                          g.src = u + 'matomo.js';
                          s.parentNode.insertBefore(g, s);
                      })();
                  </script>
      ----
      

      Solution

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: