Error uploading conversion type - Unmarshalling error

42 views
Skip to first unread message

Dante Andriano

unread,
Jun 2, 2020, 10:38:54 AM6/2/20
to AdWords API and Google Ads API Forum
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);

Google Ads API Forum Advisor Prod

unread,
Jun 2, 2020, 2:40:52 PM6/2/20
to andri...@gmail.com, adwor...@googlegroups.com
Hi Dante,

Thank you for reaching out. Can you please share the complete detailed request and response logs for your call via Reply privately to author so I can further investigate the issue? You can find information on enabling logging here (log level DEBUG).

You can find an example for creating a conversion tracker here.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5004Q20VVhN:ref

Dante Andriano

unread,
Jun 3, 2020, 9:37:39 AM6/3/20
to AdWords API and Google Ads API Forum
Thanks a lot!

For anyone reading this in the future, the link provided works.
Reply all
Reply to author
Forward
0 new messages