How to batch requests to OfflineConversionAdjustmentFeedService?

26 views
Skip to first unread message

Jonas Bolin

unread,
Mar 26, 2020, 6:51:36 AM3/26/20
to AdWords API and Google Ads API Forum
Am using this Python code upload conversion adjustments one by one, to the Adwords API.
However, I would like to batch them. And send up all conversions at once. Is this possible, and can anyone give some hints on where in the code I am missing something?

import uuid
import datetime
import pandas as pd
from googleads import adwords

class Adwords:
    def __init__(self, client):
        self.client = client
        self.offline_conversion_service = self.client.GetService('OfflineConversionAdjustmentFeedService', version='v201809')
        
    def upload_adjusted_conversion(self, conversion_name, order_id, adjustment_type, adjustment_time, adjusted_value, adjusted_value_currency):
        offline_conversion_service = self.client.GetService('OfflineConversionAdjustmentFeedService', version='v201809')

        feed = {
            'xsi_type': 'OrderIdOfflineConversionAdjustmentFeed',
            'conversionName': conversion_name,
            'orderId': order_id,
            'adjustmentType': adjustment_type,
            'adjustmentTime': adjustment_time,
            'adjustedValue': adjusted_value,
            'adjustedValueCurrencyCode': adjusted_value_currency
        }
        offline_conversion_operation = {'operator': 'ADD', 'operand': feed}
        try:
            offline_conversion_response = self.offline_conversion_service.mutate([offline_conversion_operation])

            new_feed = offline_conversion_response['value'][0]

            print('Uploaded offline conversion adjustment value of "%s" for Google ''Order ID "%s"' % (new_feed['adjustedValue'],new_feed['orderId']))
        except:
            print("Error")
            


    def import_conversion_adjustments_for_existing_conversions(self,dataframe):
        for row in dataframe.iterrows():
            record = row[1]
            self.upload_adjusted_conversion(record['Conversion Name'],record['Order ID'],record['Adjustment Type'],record['Adjustment Time'],record['Adjusted Value'],record['Adjusted Value Currency'])

Google Ads API Forum Advisor Prod

unread,
Mar 26, 2020, 10:33:41 AM3/26/20
to jo...@56kdigital.se, adwor...@googlegroups.com
Hi Jonas,

Thank you for reaching out. Unfortunately, the OfflineConversionAdjustmentFeedService isn't a supported batch job service. You can see the available services here.

Regards,
Mitchell
Google Ads API Team

ref:_00D1U1174p._5001UXWncD:ref
Reply all
Reply to author
Forward
0 new messages