$demoError = $demo->getError(); } } } } // The PHP library will try to update the access token // (via the refresh token) when an API request is made. // So the actual token in apiClient can be different after // a require through Google_AnalyticsService is made. Here we // make sure whatever the valid token in $service is also // persisted into storage. $storage->set($client->getAccessToken()); } } // Consolidate errors and make sure they are safe to write. $errors = $demoError ? $demoError : $authHelper->getError(); $errors = htmlspecialchars($errors, ENT_NOQUOTES); ?> <!DOCTYPE> <html> <head> <title>Google Analytics API v3 Sample Application</title> </head> <body> <h1>Google Analytics API v3 Sample Application</h1> <p>This is a sample PHP application that demonstrates how to use the Google Analytics API. This sample application contains various demonstrations using the Google Analytics <a href="http://code.google.com/apis/analytics/docs/mgmt/v3/mgmtGettingStarted.html">