I already have a google analytics account. so when I try to run HelloAnalytics.php following Hello Analytics API: PHP quickstart for service accounts
It's response:
{"error":{"errors":[{"domain":"global","reason":"insufficientPermissions","message":"User does not have any Google Analytics account."}]
You are attempting to authenticate to Google Analytics using a Service account. Service accounts by default do not have any google analytics accounts.
Add service account to Google Analytics account The newly created service account will have an email address, -@developer.gserviceaccount.com; Use this email address to add a user to the Google analytics account you want to access via the API. For this tutorial only Read & Analyze permissions are needed.