AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2.9K members online now
2.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google Analytics Api

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello Team,

I am facing some problem in Google Analytics API . I have a website - http://jafri.se/cityguiden. I have created an google analytics account. I just want to fetch my websites total page views and unique page views from google analytics API on my website page.I am using PHP Language. but I am not getting correct API from google analytics account. Could you please help me to sort out this problem as soon as possible or send me some links.

Google Analytics Api

Participant ✭ ☆ ☆
# 2
Participant ✭ ☆ ☆

Hi, SHIWALI

 

Could you please describe what numbers you're fetching and what is the mismatch?

Re: Google Analytics API

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi,

 

I am using GitHub  code for getting the my website total page views  and unique page views. Please check the below link..

https://github.com/erebusnz/gapi-google-analytics-php-interface

 

But this API not giving me correct results. Please check the screenshot of incorrect result...

http://prnt.sc/dxmoss

 

I need to fetch data on my website that shown in below screenshot ..Please check this screenshot:

http://prntscr.com/dxmq0f

Could you please discuss the correct way how should I get this data on my website. It would be very helpful for me.

 

Thanks

 

 

 

Google Analytics Api

Participant ✭ ☆ ☆
# 4
Participant ✭ ☆ ☆

you'll need to modify your request

requestReportData(145141242,array('browser','browserVersion'),array('pageviews','visits'));

will catch data for browser and browser versions. But in your report data are splitted by Page so I assume you'll need

requestReportData(145141242,array('pagePath'),array('pageviews','visits'));

Also you may need to clarify data range for request.

Google Analytics Api

Participant ✭ ☆ ☆
# 5
Participant ✭ ☆ ☆

Also consider to switch to native Google API PHP client https://developers.google.com/api-client-library/php/ since it seems to be better documented