Answer the question
In order to leave comments, you need to log in
How to fix GAPI error: Failed to request report data. Error: “User does not have any Google Analytics account.”?
$this->ga = new gapi($myemail, $path_to_key_p12);
if (false === $this->ga->requestReportData(
$ga_id,
array_merge(array('country'), $dimensions),
$metrics,
'-visits',
$filter,
$datestart, $datefinish,
1, 1000))
{
return false;
}
/** @var gapiAccountEntry $result */
$result = null;
foreach ($this->ga->getResults() as $result) {
$row['site_uid'] = $site_id;
$row['country'] = $result->getCountry();
$row['visitors'] = $result->getVisitors(); // unique
$row['pageviews'] = $result->getPageviews();
$row['visits'] = $result->getVisits();
$row['crdate'] = $result->getDate());
$this->save_ga_data($type, $row);
}`
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question