Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No matomo javascript code in header #4890

Open
gatonero opened this issue Oct 12, 2023 · 7 comments
Open

No matomo javascript code in header #4890

gatonero opened this issue Oct 12, 2023 · 7 comments

Comments

@gatonero
Copy link

gatonero commented Oct 12, 2023

I'm trying to activate matomo in my webtree installation. I activated the modul but I don't see any matomo code in the header in the source files. My generated modul config is:

<script type="text/javascript">
    var _paq = window._paq || [];
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
        var u="https:\/\/stammbaum.matomo.cloud\/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', "1"]);
        _paq.push(['setUserId', "ChristophS"]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
    })();
</script>

v 2.1.17

@fisharebest
Copy link
Owner

I don't see any matomo code in the header in the source files.

Tracking is only added to the genealogy pages - not the administration pages.

@gatonero
Copy link
Author

Jumping to genealogy pages as administrator and other minor privileged users doesn't show the matomo javascript calling from my LAN. But users from WAN get now monitored.

@fisharebest
Copy link
Owner

When you access the site from your LAN, do you use the same URL?

I guess that matomo only runs when the URL matches the value set in the snippet.

@fisharebest
Copy link
Owner

Did you set the DNT (do not track) header in your browser?

webtrees will obey this header.

@gatonero
Copy link
Author

Good hint! So I deactivated DNT but nevertheless in the source code I don't see the matomo script. Surprisingly it works when visitors come from outside (WAN).

@fisharebest
Copy link
Owner

it works when visitors come from outside (WAN).

My guess is that the tracking script itself doesn't run when accessed locally.

This answer on stack-overflow appears to confirm this. Tracking local access needs to be specifically enabled.

https://stackoverflow.com/questions/13688749/piwik-localhost-tracking

@gatonero
Copy link
Author

gatonero commented Oct 19, 2023

This is my supposition also. I tried the suggested solution on stackoverflow but that didn't work. Under [General I entered

trusted_hosts[] = "localhost"
trusted_hosts[] = "192.168.178.100"

in matomos config.ini.php.

But this doesn't affect webtrees to generate the script code as I assumed. Also it would be nice to have some more configuration options in webtrees for matomo e.x. for Tracking Manager etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants