I'm getting Error :
"code":500,"message":"There was an internal error."
exception every time I'm trying to link Google analytics to Adwords via Analytics Management API.
Code is pretty straightforward (PHP), just like documentation example:
$adwordsAccounts = [];
foreach ($adwordsAccountIds as $customerId) {
$adwordsAccount = new \Google_Service_Analytics_AdWordsAccount();
$adwordsAccount->setCustomerId($customerId);
$adwordsAccount->setAutoTaggingEnabled(true);
$adwordsAccounts[] = $adwordsAccount;
}
$adWordsLink = new \Google_Service_Analytics_EntityAdWordsLink();
$adWordsLink->setName('AdWords Link');
$adWordsLink->setAdWordsAccounts($adwordsAccounts);
$response = $client->management_webPropertyAdWordsLinks->insert($accountId, $webPropertyId, $adWordsLink);
google-api-php-client library version is latest (2.2.0)