Hello Johan,
What happens if you try the following NGINX config:
if ($request_uri ~ "koko_analytics_collect") {
set $is_trusted 1;
}
That should account for both the default /wp-admin/admin-ajax.php and the /koko-analytics-collect.php endpoint.
Let us know if that does the trick please.
It worked a little better. The problem now is that I get the 500 error when logged out. When I’m logged in it works just fine.
PHP Fatal error: require(): Failed opening required ‘/nas/content/live/[CUSTOMER]/wp-content/plugins/koko-analytics/src/functions.php’ (include_path=’.:/usr/share/pear/php:/usr/share/php’) in /nas/content/live/[CUSTOMER]/koko-analytics-collect.php on line 14
Hello Johan,
That’s weird. Looks like the actual tracking is now firing, but generating an error.
It looks like the custom tracking endpoint file exists but has a wrong path in it. If you visit the Koko Analytics dashboard page then the plugin should pick up on the error and attempt to remove the endpoint file, but if the website root is not writable (anymore) then it may not succeed in deleting it.
If you manually delete the file /koko-analytics-collect.php in your website root directory then the error will be gone.
pageviews.php is in root since WP Engine doesn’t allow for php to run in wp-content.
/koko-analytics-collect.php is automatically recreated if I delete it.
Now I was able to delete koko-analytics-collect.php without it reappearing. But still I get that 500 error. https://[DOMAIN]/wp-admin/admin-ajax.php?action=koko_analytics_collect&p=277&nv=0&up=0&r=&rqp=ub2qoh7xt8 500
Hello Johan,
Is the 500 error for the fatal error you posted earlier? If so, can you please verify whether the wp-content/plugins/koko-analytics/src/functions.php file exists?
If it doesn’t, your plugin installation is somehow missing crucial files. But if the admin pages of the plugin work just fine, this really shouldn’t be the case.
The plugin will also respond with a 500 error in case the pageviews.php file is not writable. So I would also check whether that file is writable by the system user that your webserver (usually nginx or Apache) is running as.