Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /**
  2. * Note: This code assumes you have an authorized Analytics service object.
  3. * See the Data Import Developer Guide for details.
  4. */
  5.  
  6. // This request uploads a file to a particular custom data source.
  7. try {
  8. $analytics->management_uploads->uploadData(
  9. '123456',
  10. 'UA-123456-1',
  11. '987654321',
  12. array(
  13. 'data' => file_get_contents('example.csv'),
  14. 'mimeType' => 'application/octet-stream',
  15. 'uploadType' => 'media'));
  16. } catch (apiServiceException $e) {
  17. print 'There was an Analytics API service error '
  18. . $e->getCode() . ':' . $e->getMessage();
  19. } catch (apiException $e) {
  20. print 'There was a general API error '
  21. . $e->getCode() . ':' . $e->getMessage();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement