I am using google-ads-api. My goal is to get impressions and clicks for specific campaign. These are the things I have done.
- created google service account
- Downloaded google-ads-library from github
- Added clientid , secretid, refresh token to my adsapi.ini file.
When I run the code it gives me error .
Google\ApiCore\ApiException { "message": "The caller does not have permission", "code": 7, "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.ads.googleads.v9.errors.GoogleAdsFailure", "errors": [ { "errorCode": { "authorizationError": "USER_PERMISSION_DENIED" }, "message": "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid" } ], "requestId": "pKHgfIr99F5XApaPFBnrLQ" } ] }
my adsapi.ini
[GOOGLE_ADS]
; Required Google Ads properties.
name = "Google Ads"
developerToken = "*****-*******_*"
; Optional. Set a friendly application name identifier.
userAgent = "Scraper"
; Optional additional AdWords API settings.
; endpoint = "https://adwords.google.com/"
; isPartialFailure = false
; Optional setting for utility usage tracking in the user agent in requests.
; Defaults to true.
; includeUtilitiesInUserAgent = true
[ADWORDS_REPORTING]
; Optional reporting settings.
; isSkipReportHeader = false
; isSkipColumnHeader = false
; isSkipReportSummary = false
; isUseRawEnumValues = false
[OAUTH2]
; Required OAuth2 credentials. Uncomment and fill in the values for the
; appropriate flow based on your use case. See the README for guidance:
; https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started
; For installed application or web application flow.
clientId = "**********************"
clientSecret = "********************"
refreshToken = "***********************"
For service account flow.
; jsonKeyFilePath = "INSERT_ABSOLUTE_PATH_TO_OAUTH2_JSON_KEY_FILE_HERE"
; scopes = "https://www.googleapis.com/auth/adwords"
; impersonatedEmail = "INSERT_EMAIL_OF_ACCOUNT_TO_IMPERSONATE_HERE"
[SOAP]
; Optional SOAP settings. See SoapSettingsBuilder.php for more information.
; compressionLevel = <COMPRESSION_LEVEL>
; wsdlCache = <WSDL_CACHE>
[PROXY]
; Optional proxy settings to be used by SOAP requests.
; host = "<HOST>"
; port = <PORT>
; user = "<USER>"
; password = "<PASSWORD>"
[LOGGING]
; Optional logging settings.
; soapLogFilePath = "/soap.log"
; soapLogLevel = "INFO"
; reportDownloaderLogFilePath = "path/to/your/report-downloader.log"
; reportDownloaderLogLevel = "INFO"
; batchJobsUtilLogFilePath = "path/to/your/bjutil.log"
; batchJobsUtilLogLevel = "INFO"