Building a google analytics webpage simple dashboard using GA4
With the July 1 2023 date fast approaching for the google analytics UA property types to be a thing of the past. I did some reading today about using the google analytics embed API to build a new page for GA4. However the embed API does not support GA4.
I have read other articles of how to do this since i have never coded one before but for the most part it appears the new GA4 is far from user friendly. What they offer is the analytics reporting API which is way over my head in understanding and is also way too powerful for what i need. I dont need to push data or run different reports, i just want a dashboard page with data. The other option is the analytics data API which again seems very complicated.
Youtube is not much help because alot of them cover the old UA property and they also push third party "pay to play" type scripts that i dont want to use.
I wanted to use PHP and JSON and JS to do this. Has anyone tackled this for GA4 yet. I am not asking for free code just to point me in the right direction so i can get started without having to jump ship midway because i used the wrong API.
Any help would be appreciated.... thanks :)
-
Hey there! I don't think the cPanel Forums are going to be of much help for this type of request. You might have better luck with a development-specific forum, or even something like Stack Overflow. 0 -
Hi, thanks for your reply. Yeah i have been down a huge rabbit hole on this one, seems that whichever way i turn its going to be a paid service one way or the other, if not the paid google service then some other service. I did find a good script but since GA4 is no longer going to support UA views (the sublet of properties) then it wont work either. That does not include adding security using SAML, OpenId, or AWS to secure the JSON file, and that will have to be a paid deal as well. Here is what i found but as i said google has limited the views feature to the paid GA4 only. I did get it to work using an old UA view id, but as of the end of this month that is gone and the work arounds are quite pathetic. as well as as not all of my users will have cPanel i will need to write something for the masses. It is still early in my learning curve so i hope to put together something. I think both of those are part of cPanel or at least available from the host. The trick is to be able to view the stats page as a seperate document in the browser so i can load it as part of the site page. At first glance it looks like analog is dedicated to cPanel login only, but webalizer might be the ticket as it appears there is some kind of process for accessing it programmincally. Do you have any knowledge of analog or webalizer yourself? 0 -
Both of those tools have a LARGE amount of stats, with Analog being the most verbose. 0 -
Both of those tools have a LARGE amount of stats, with Analog being the most verbose.
The problem with webalizer is that first my host wont enable it on my shared server and on the website i cant seem to figure out how to even download it, something to do with anonymous ftp but i have no clue about that and it does not give a password either. Plus it has to be compiled which i cant do on a shared server. Analog i can download but im sure cPanel has a much modded version of analog because the analog website is old and dusty from 2004 and seems the script got abandoned after that. So its very old and out of date which is why i think that version and the cPanel version are way different. So where i am on this is that i am at the point that i will most likley have to take three scripts, analog, and two scripts from github and pick pieces of them that gets the data i need and just recode it my way building the puzzle pieces until i get what i want. The visual i can handle no problem i just need to find the raw data somehow. This is the data i believe i need to start with. The server data i can get using PHP and/or shell_exec as long as shell_exec it is enabled on the server. But for site stats i will need: Visits and all data associated with the visit (client, version, referred by, page departed on, duration, bounce rate, country, ip) Then i will also need separate data for page views, bounce rate, unique visitors, pages per visit, latest visits, search terms, and search engine) and average from aggregate numbers for some of those same stats. So that is where i am at now... suggestions are appreciated :)0 -
Hi, anyone know if analog data can be accessed programmically? Even if i can get it via command line would be ok i can just use shell_exec. 0 -
Stats are in /home/$user/tmp, feel free to look at those files and see 0 -
Stats are in /home/$user/tmp, feel free to look at those files and see
Great found them, thanks so much. Also a quick update here regarding the google analytics info and the non support of ViewId going foward. I was thinking there is no way that google is going to turn their back on millions of small businesses and thousands of third party vendors that need the analytics data, IMO google is not going to ask all those people to put up $150,000 for analytics 360 just to get stats. So i did some more digging and i found it... All google did was change the API that you use, now just use the google analyitcs data API (not the analytics reporting API). Plus the google analytics data API uses the property ID which is awesome.. So whalllllaaaa! looks like i have the google part of getting the data complete... Now i just need to work on the option for those that dont have cPanel.0
Please sign in to leave a comment.
Comments
7 comments