matomo-org / docker

Official Docker project for Matomo Analytics
https://matomo.org
Other
834 stars 346 forks source link

Wrong address in tracker code #251

Open natsu90 opened 3 years ago

natsu90 commented 3 years ago

using docker-compose from .examples/nginx, then running all necessary steps to get the first web tracking code, then I noticed it's displaying internal docker IP (172.18.0.2) instead of the current address (134.209.75.24:8080) in the tracking code

<!-- Matomo -->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//172.18.0.2/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Matomo Code -->

Notes: to get Docker internal IP, https://stackoverflow.com/a/20686101

EDIT: the address seems to be correct from dashboard page

drzraf commented 2 years ago

Can reproduce too. Matomo has no clue about the external domain it's being hit from. Any environment variable for this?

J0WI commented 1 year ago

Maybe https://github.com/matomo-org/docker/issues/210 or https://github.com/matomo-org/docker/issues/295 help here.