been working on this for two days now and seem to be getting nowhere.
I am using the GAPI Google analytics PHP class. This is the current code I have the now:
$ga->requestReportData("[UID]",array('day'),array('visits'), array("day"));
What I want to do is get the number of "pageviews" from the "past 7 days". So output would be something like:
<?php foreach($ga->getResults() as $result) { ?>
Date: <?php echo $result; ?>
Page Views: <?php echo $result->getPageviews(); ?>
<?php } ?>
I am new to Google analytics API so not sure where to start. Thanks for any help!
Will like to make an addition to @ladiesMan217 , we can create application specific passwords if we have 2 steps verification on.
As far as GAPI is concerned i have created a class which will give lot of information but by using couple of methods. You can download the class here http://www.thetutlage.com/post=TUT217
?>
First Method trafficCount will give you ( PageViews , Visits, Bounce Rate, Time spend of site, New Visits )
Second Method referralCount will give you ( referral url and total number of hits from that url )
Third Method sourceCountNum will provide you traffic source like ( Direct Traffic, Organic ,Referral, Feed, Emails and Others )
Last Method sourceCountPer will provide same info as the 3rd one with one difference here the information will be in Percentage.
Hope it will be of some help and please let me know in case of any bugs.
This should help you
Keep in mind to turn off your 2-step verification for the google account. If you don't , it will throw you a bad request error despite the validity of your account info.