I have this page view counter showing the views for the current post. I’m using an Google APIs Client Library for PHP and it worked fine with Google Analytics UA but now that GA4 took place definitely (in july, 2024) it is dead and I keep getting the error 403, “User does not have sufficient permissions for this profile.”.
I tried to update the API Library, but it is no longer maintained. With some debugging I could notice that the problem is that the script is using the “view_id” which is no longer available in the analytics new version. I did search a lot, but every solution that I get is outdated and keep telling me to setup the “view_id”. So guys, how could I retrieve the GA4 page views (or sessions) for the a current post?
Lyccos N. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.