# 커스텀 컴포넌트로 추적 코드를 추가할 때 CSP를 수정하는 것을 잊었습니다

**URL:** <https://meta.discourse.org/t/forgot-to-edit-csp-when-adding-tracking-code-via-custom-component/174811>\
**Category:** Product Support\
**Created:** [1월 2, 2021, 4:18오후 UTC](https://meta.discourse.org/t/forgot-to-edit-csp-when-adding-tracking-code-via-custom-component/174811 "2021-01-02T16:18:22Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Antony](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antony/32/204487_2.png) [@Antony](https://meta.discourse.org/u/Antony)\
**Post date:** [1월 2, 2021, 4:18오후 UTC](https://meta.discourse.org/t/forgot-to-edit-csp-when-adding-tracking-code-via-custom-component/174811/1 "2021-01-02T16:18:22Z")

</div>

**`</head>`** 안에 다음을 추가해 보았습니다.

```plaintext
<!-- Matomo - head -->
<script type="text/discourse-plugin" version="0.2">
    // 페이지 뷰 추적 
    api.onPageChange((url, title) => {
        if (_paq) {
            try {
                var currentUser = PreloadStore.get('currentUser');
                _paq.push(['setCustomVariable', 3, 'Forum status', !currentUser ? 'Anonymous' : 'LoggedIn user', 'visit']);
            } catch(e) {} 
              
            _paq.push(["setCustomUrl", url]);
            _paq.push(["setDocumentTitle", title]);
            _paq.push(["trackPageView"]);
        }
    });
</script>
<!-- /Matomo - head -->

```

그리고 **`</body>`** 안에 다음을 추가했습니다.

```plaintext
<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq = window._paq || [];
  /* "trackPageView"를 호출하기 전에 "setCustomDimension" 같은 트래커 메서드를 호출해야 합니다 */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="https://stats.xxxxxxx.xxx/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '8']);
    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 -->

```

그런데 결과적으로 페이지의 HTML 소스에서 보이는 것은 HTML 주석뿐입니다. `<script>` 태그가 제거된 것으로 보입니다.

해당 영역에서 스크립트를 허용하도록 활성화해야 하는 보안 설정이 있을까요?

```plaintext
<!-- Matomo - head -->

<!-- /Matomo - head -->
[...]
<!-- Matomo -->

<!-- End Matomo Code -->

```

도움 주셔서 감사합니다.

---

_[View the full topic](https://meta.discourse.org/t/forgot-to-edit-csp-when-adding-tracking-code-via-custom-component/174811)._
