Hi! I've got an error with the google ads API while trying to upload a new
conversion type. I was following this tutorial
http://www.ewanheming.com/adwords-api-offline-conversion-import
And I think I almost had it, but then I got this error which I can't solve:
Error: Unmarshalling Error: cvc-elt.4.3: Type 'ns1:UploadConversion' is not
validly derived from the type definition, 'string', of element
'ns1:operator'.
Now I've checked a bit of the library code and the operator is the object
per se. Its like its complaining because its not a string? I've already
checked and have a stable connection with the API,
already did some calls to it with success. I've tried adding more fields to
the upload conversion object, that also did not work. I tried mutateLabel
which I saw somewhere, but its not a function
that exists in adwords services class. Any ideas what I'm doing wrong?
Thanks in advance!
Code:
$this->adWordsServices = new AdWordsServices();
$this->oAuth2Credential = (new
OAuth2TokenBuilder())->fromFile(getcwd() . '/adsapi_php.ini')->build();
$this->session = (new
AdWordsSessionBuilder())->fromFile()->withOAuth2Credential($this->oAuth2Credential)->build();
$conversionTrackerService =
$this->adWordsServices->get($this->session,
ConversionTrackerService::class);
//LOAD CONVERSION TYPE DATA
$uploadConversion = new UploadConversion();
$uploadConversion->setName($nombreTipoDeConversion);
$uploadConversion->setCategory("DEFAULT");
$uploadConversion->setCtcLookbackWindow(90);
$uploadConversion->setViewthroughLookbackWindow(30);
//ORIGINAL CODE DID NOT INCLUDE THESE LINES IN HOPES OF SOLVING THE
ERROR WITH NO AVAIL
$uploadConversion->setConversionTrackerType("AdWordsConversionTracker");
$uploadConversion->setCountingType("ONE_PER_CLICK");
$uploadConversion->setAttributionModelType("U_SHAPED");
$uploadConversion->setExcludeFromBidding(false);
$uploadConversion->setAlwaysUseDefaultRevenueValue(true);
$uploadConversion->setDefaultRevenueCurrencyCode("USD");
$uploadConversion->setDefaultRevenueValue(0.0);
$uploadConversion->setStatus("ENABLED");
//SEND CONVERSION
$operations = array(new ConversionTrackerOperation($uploadConversion,
"ADD"));
$result = $conversionTrackerService->mutate($operations);
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/392bad21-ed54-489d-88bc-5392a46275a6%40googlegroups.com.