Hi,
Thanks for posting your concern to us.
Thanks for reaching out to us. I had to delete your initial post as it
contained your sensitive information. I am reposting below without the
sensitive information for reference :
“Hi,
I'm using the PHP API.
We recently implemented conversion adjustments successfully, and now we're in
the process of migrating the rest our system from Adwords API to Google Ads API.
The problem is that I am getting an authorization error that I am not getting
with the conversion adjustments, even though I'm using the same credentials.
I put everything in one script to demonstrate this:
<?php
use \Google\AdsApi\Common\OAuth2TokenBuilder;
use \Google\Ads\GoogleAds\Lib\V8\GoogleAdsClientBuilder;
use \Google\Ads\GoogleAds\V8\Services\ConversionAdjustment;
use \Google\Ads\GoogleAds\Util\V8\ResourceNames;
use
\Google\Ads\GoogleAds\V8\Enums\ConversionAdjustmentTypeEnum\ConversionAdjustmentType;
use \Google\Ads\GoogleAds\V8\Services\RestatementValue;
use \Google\Ads\GoogleAds\Util\V8\GoogleAdsFailures;
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile(SYSTEM_BASEDIR.'/include/global/config/adsapi_php.ini')
->build();
$env = parse_ini_file(SYSTEM_BASEDIR.'include/global/config/adsapi_php.ini');
$googleAdsClient = (new GoogleAdsClientBuilder())
->withDeveloperToken($env['developerToken'])
->withLoginCustomerId(MAIN_ACCOUNT)
->withOAuth2Credential($oAuth2Credential)
->build();
/**************** CONVERSION ADJUSTMENT *****************/
$conversion_adjustment = new ConversionAdjustment([
'conversion_action' => ResourceNames::forConversionAction(MAIN_ACCOUNT,
CONVERSION_ACTION_ID),
'adjustment_type' => ConversionAdjustmentType::RESTATEMENT,
'order_id'=>123456,
'adjustment_date_time' => date("Y-m-d H:i:sP", strtotime("-1 hour"))
]);
$conversion_adjustment->setRestatementValue(new RestatementValue([
'adjusted_value' => 25
]));
$conversionAdjustmentUploadServiceClient =
$googleAdsClient->getConversionAdjustmentUploadServiceClient();
$response =
$conversionAdjustmentUploadServiceClient->uploadConversionAdjustments(
SUB_ACCOUNT,
[$conversion_adjustment],
true
);
if (!is_null($response->getPartialFailureError()))
{
echo "---------------- Conversion Adjusment Failure:\n";
$failure =
GoogleAdsFailures::fromAny($response->getPartialFailureError()->getDetails()[0]);
foreach($failure->getErrors() as $error)
{
echo $error->getMessage()."\n";
}
}
/********************** REPORTING *********************/
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$query =
"SELECT campaign.id, campaign.name FROM campaign ORDER BY campaign.id";
try {
$results = $googleAdsServiceClient->search(SUB_ACCOUNT, $query);
} catch (Exception $e)
{
echo "\n----------------- Reporting Failure:\n";
echo $e->getMessage()."\n";
}
?>
The output of the script is:
---------------- Conversion Adjusment Failure:
This customer does not have a conversion action of a supported
ConversionActionType that matches the conversion action provided.
----------------- Reporting Failure:
I'm not concerned with the conversion adjustment failure, since it's a dev
account.
Please advise regarding the authorization error.
Thank you.
”
Could you provide us with the complete request and response logs with the
request-id when you encountered the authorization error, so our team can better
check?
If you haven't yet, logging can be enabled by navigating to the Client
libraries > Your client library (ex. PHP) > Logging documentation, which you
can access from this link. You may then send the requested information via the
Reply privately to author option. If this option is not available, you may send
the details directly to our [email protected] alias instead.
Regards,
Yasar
Google Ads API Team
ref:_00D1U1174p._5004Q2PJC9Q:ref
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/DqlHG000000000000000000000000000000000000000000000R0YMFG00K5qTFNZTTiGjytr_VrTjDw%40sfdc.net.