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

[googleanalytics] Extract inline script block in WEB-INF/classes/hudson/plugins/google/analytics/GoogleAnalyticsPageDecorator/header.jelly

XMLWordPrintable

      Problem

      == Inline Script Block
      Line: 3
      ----
      <script type="text/javascript">
                  var _gaq = _gaq || [];
                  _gaq.push(['_setAccount', '${it.profileId}']);
                  <j:if test="${it.domainName!=null}">
                      <j:choose>
                          <j:when test="${it.domainName=='none'}">
                  _gaq.push(['_setDomainName', 'none']);
                  _gaq.push(['_setAllowLinker', true]);
                          </j:when>
                          <j:otherwise>
                  _gaq.push(['_setDomainName', '${it.domainName}']);
                          </j:otherwise>
                      </j:choose>
                  </j:if>
                  _gaq.push(['_trackPageview']);
              
                  (function() {
                      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, 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: