V
V
V_Kotkovets2015-11-03 11:23:02
Google
V_Kotkovets, 2015-11-03 11:23:02

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);
    }`

There is an array ga_id id of partner site accounts. With the help of this little thing, information about partner sites was taken earlier. Recently, Google removed authorization by login password, I had to redo the script. So, the script works for your site, but not for partner sites. The object is created but returns an error(in the title) . And everything works fine from the developer console. Maybe someone faced this problem.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question