matomo-org / matomo-for-wordpress

Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
https://matomo.org
GNU General Public License v3.0
119 stars 25 forks source link

All actions appear twice in the statistics #713

Closed ehauser22 closed 1 year ago

ehauser22 commented 1 year ago

Hello, I have Matomo for wordpress and all the actions always appear in double. I have no idea why. How could I fix it ? I did not find any information on the FAQ pages. Thanks! Kind regards! Emilie

mattmary commented 1 year ago

Hello @ehauser22

Thank you for reaching us out. Could you post some screenshots of your problem please? Could you also either DM me or email me your website URL? And finally, could you also post your system report please? https://matomo.org/faq/wordpress/how-do-i-find-and-copy-the-system-report-in-matomo-for-wordpress/

Thanks in advance Kind regards

Mat

mattmary commented 1 year ago

Hello @ehauser22

Any chances you read my previous comment? Do you still encounter the problem? Kind regards

Mat

ehauser22 commented 1 year ago

Hello Sorry for the delay. I still have the problem. Here are some examples

image

ehauser22 commented 1 year ago

Here is the system report

              # Matomo

Endpoints

Crons

Contrôles obligatoires

Contrôles facultatifs

Matomo Settings

Logs

WordPress

WordPress Plugins

Server

Database

Browser

ehauser22 commented 1 year ago

And this is my website: https://xxxx.fr Thank you very much for your help Kind regards Emilie

mattmary commented 1 year ago

Hello @ehauser22

Thank you. First, I've hidden your URL for security reasons (your system report provides a lot of information on your configuration, it could help hackers to hack your website).

Indeed your visits seems duplicated. It would happen if your visitors would refresh their page, but we can definitively consider not all your visitors do that for all your pages :) When browsing your website, I can see that there is twice the Matomo tracker in your pages. image And in your source code, the tracker seems to be called twice from a different way. This is why your actions appear twice in your visitor log.

One of this call in your source code seems related to your WP-Rocket plugin. Do you have the WP-Rocket option "Load Javascript deffered" checked from your /wp-admin/options-general.php?page=wprocket#file_optimization page? Maybe you could try to uncheck it and see if the problem happens again? (I can check it for you if you tell me when you've unchecked it). So this is what I'll do next to fix this issue.

Kind regards

Mat

mattmary commented 1 year ago

Hello @ehauser22

Any chances you read my previous comment? Did it help? Kind regards

Mat

ehauser22 commented 1 year ago

Hello Thank you for your email. I have unchecked the "Load Javascript deffered" option when I received your previous mail, but everything still appears in double. I have either all the actions in double, or some times the visit appears twice: like in the screen shot here attached. You can see that the visits of 00h12 and 21h21 are exactly the same and appears in double. Kind regards Emilie

image

mattmary commented 1 year ago

Hello @ehauser22

After more investigation, I think the problem is related to your complianz integration:

You have two Matomo trackers included in your website:

The second integration is:

<!-- Statistics script Complianz GDPR/CCPA -->
                        <script type="rocketlazyloadscript"  data-category="functional">var _paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(['requireCookieConsent']);

(function() {
    var u="//wp-content/plugins/matomo/app/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    _paq.push(['setSecureCookie', window.location.protocol === "https:" ]);
    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);
})();

document.addEventListener("cmplz_fire_categories", function (e) {
    var consentedCategories = e.detail.categories;
    if (!cmplz_in_array( 'statistics', consentedCategories )) {
        _paq.push(['forgetCookieConsentGiven']);
    } else {
        _paq.push(['rememberCookieConsentGiven']);
    }
});

</script>

But it should be:

<!-- Statistics script Complianz GDPR/CCPA -->
                        <script type="rocketlazyloadscript"  data-category="functional">var _paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
_paq.push(['requireCookieConsent']);
_paq.push(['setSecureCookie', window.location.protocol === "https:" ]);

document.addEventListener("cmplz_fire_categories", function (e) {
    var consentedCategories = e.detail.categories;
    if (!cmplz_in_array( 'statistics', consentedCategories )) {
        _paq.push(['forgetCookieConsentGiven']);
    } else {
        _paq.push(['rememberCookieConsentGiven']);
    }
});

</script>

What you can do is to:

Mat

ehauser22 commented 1 year ago

Hello

Thanks for your answer.

I don't know how to find and remove the second integration. How should I do? I am not sure if it was added by the Complianz add-on or by the person who has built my website. And should I remove it entirely or should I replace it by the code you put under "it should be:"?

Also, you have warned me about disclosing my website url, but it appears in the code of the second integration. Could you hide it please?

Thank you very much Kind regards

Emilie

mattmary commented 1 year ago

Hello @ehauser22

I had a look how the complianz plugin works, and it seems this integration is automatically generated by this plugin. I would try to uncheck the Matomo support in the wizard to remove this second integration: image

And then please copy and paste the script I gave you in the Matomo manual tracker script. (I forgot to mention that you'll have to replace wordpress.local by your hostname).

Kind regards

Mat

ehauser22 commented 1 year ago

Hello

I replied by email but I think you did not receive it. What is the "hostname"? Is it my computer name? or is it my url? or is it the company who is hosting my website?

Thank you for your help! Kind regards

Emilie

mattmary commented 1 year ago

Hello @ehauser22

You're right: I didn't receive so far your question. Your domain name is your website URL.

Kind regards

Mat

mattmary commented 1 year ago

Hello @ehauser22

Have you been able to solve your problem?

Kind regards

Mat

mattmary commented 1 year ago

Hello @ehauser22

Without any answer, I close this issue. Feel free to open a new one if you still have issues. Kind regards

Mat