Mam problem z pobraniem danych z GA za pomocą skryptu php.
Korzystam z gotowej klasy gapi ->
https://code.google.com/p/gapi-google-analy...s-php-interface
(proszę spacje pousuwać z adresu)
Podczas uruchomienia skryptu lokalnie otrzymuję błąd:
Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to authenticate user. Error: "Error=BadAuthentication Url=https://www.google.com/accounts/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtZJYTUg3dFuqdNpJYVABbupauXITr7yA5Q_nibJrVOZ3X32zMgwi66rH6TPDjp4kfs
b0B4Mio5CBF5sZ-iJ6nbaVBg3hRw-joTNHGrIzp-klSWrSQg8NLk3NC7AAt1e37I4aNKGxDinEV5W-YGOzvWBpdovr-ggiTTIO_SB2a2PSQJSyW4sV7lSvYvomuljb942WN9buTby9mrwDn4YHNW4GvJrCxO2twClDnO0enTDgo
Sc8Q Info=WebLoginRequired "' in D:\XAMPP\htdocs\Gapi\gapi-1.3\gapi.class.php:418 Stack trace: #0 D:\XAMPP\htdocs\Gapi\gapi-1.3\gapi.class.php(62): gapi->authenticateUser('___@gmail.com.', '__ZZZZZ') #1 D:\XAMPP\htdocs\Gapi\index.php(16): gapi->__construct('___@gmail.com.', '__ZZZZZ') #2 {main} thrown in D:\XAMPP\htdocs\Gapi\gapi-1.3\gapi.class.php on line 418
Mam założone konto na GA. Ustawione jest śledzenie strony : http://rnest.prohost.pl/gapi/index.php
za pomocą rekomendowanego na stronie GA skryptu js. Niestety po sprawdzeniu stanu śledzenia w zakładce administracja - stan jest : Śledzenie niezainstalowane.
Skrypt do pobierania raportu z GA:
require 'gapi-1.3/gapi.class.php'; /* Set your Google Analytics credentials */ $ga = new gapi(ga_account, ga_password); /* We are using the 'source' dimension and the 'visits' metrics */ /* We will sort the result be desending order of visits, and hence the '-' sign before the 'visits' string */ $ga->requestReportData(ga_profile_id, $dimensions, $metrics, '-visits'); $gaResults = $ga->getResults(); $i = 1; foreach ($gaResults as $result) { }
Nie miałem do tej pory do czynienia z GA. Hasło, które podaje do skryptu jest hasłem mojego gmaila + adres email gmail ...
Czy może ktoś ma sugestie jak ten problem rozwiązac?