plausible / wordpress

Plausible Analytics WordPress plugin
https://plausible.io/wordpress-analytics-plugin
MIT License
52 stars 26 forks source link

Enhanced Measurements in admin not persisted #181

Closed ThomasTr closed 7 months ago

ThomasTr commented 8 months ago

The switches under enhanced mesurements in settings are not persisted. The infobox says enabled, after page reload the witch is disabled again.

Dan0sz commented 8 months ago

Are you using Redis (or another database caching mechanism) by any chance? Because I'm failing to reproduce this issue.

ThomasTr commented 8 months ago

No, don't using redis or any caching plugin.

The switch for "View stats in WordPress" works for example (setting is persisted). But the switches under "Enhanced Measures" (hope this is the english version, as my install is localized on german language) are not persisted. They are all off after page reload when i try to activate one ore more of them.

Dan0sz commented 8 months ago

Are you getting errors in your browser's console when toggling an enhanced measurement option? Or do you see anything relevant in your PHP error log?

ThomasTr commented 8 months ago

Everything seems fine, no errors at all, even the js request in background when switching is fine, example response:

{"success":true,"data":"404 Fehlerseiten enabled."}

But when i reload this page all switches in this section are off. Only the section "Erweiterte Messungen" (German translation, should be enhanced measurements) is not working. other sections like "Benutzerrollen tracken" are working fine and are persisted.

Dan0sz commented 8 months ago

One thing to verify, since 404 tracking is (or seems to be) enabled.

Could you open a page that doesn't exist (e.g. yourdomain.com/blablabla) and see if this code snippet is present in the page source?

document.addEventListener('DOMContentLoaded', function () { plausible('404', { props: { path: document.location.pathname } }); });

ThomasTr commented 8 months ago

No, I cannot find such a code on the error page. It seems, the api request says its enabled but it isn't. Therefore after an page reload in admin it shows disabled.

ThomasTr commented 7 months ago

As tracking stopped again, i removed the plugin and simple added the javascript via my themes function.php