首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >必应Ads API离线转换不导入

必应Ads API离线转换不导入
EN

Stack Overflow用户
提问于 2017-08-02 09:12:12
回答 2查看 1K关注 0票数 1

当我试图使用Bing -PHP发送离线转换数据时,我在BING Ads离线转换数据导入方面遇到了问题。根据响应,在上有空的 PartialErros,但是在Bing Ad UI上看不到数据。但是,当我使用CSV离线转换上传功能时,一切都很好。

来自必应API调用的响应:

代码语言:javascript
运行
复制
stdClass Object
(
    [PartialErrors] => stdClass Object
        (
        )
)

我使用的代码:

代码语言:javascript
运行
复制
AuthHelper::AuthenticateWithOAuth();
$GLOBALS['CustomerProxy'] = new ServiceClient(ServiceClientType::CustomerManagementVersion11,
$GLOBALS['AuthorizationData'], AuthHelper::GetApiEnvironment());
$user = CustomerManagementHelper::GetUser(null)->User;

#AccountId and CustomerId parsing code goes here

//parse $user to set AccountId 
$GLOBALS['AuthorizationData']->AccountId = $obj->Id; 

//parse $user to set CustomerId header
$GLOBALS['AuthorizationData']->CustomerId = $obj->ParentCustomerId; 

$GLOBALS['CampaignProxy'] = new ServiceClient(ServiceClientType::CampaignManagementVersion11, $GLOBALS['AuthorizationData'], AuthHelper::GetApiEnvironment());

 //send offline conversion
$offline =[];
 $offline = new OfflineConversion();
 $offline->ConversionCurrencyCode = 'USD';
 $offline->ConversionName = 'OfflineConversionSellOfRentals';
 $offline->ConversionTime =  date('Y-m-d\TH:i:s', strtotime('-7 days'));
 $offline->ConversionValue = 2.5;
 $offline->MicrosoftClickId = '8349a6501442491186ce602ca56881fe';
 $request[] = $offline;
 $offline_response = CampaignManagementHelper::ApplyOfflineConversions($request);

 print_r($offline_response);

CampaignManagementHelper.php文件中创建了一个方法

代码语言:javascript
运行
复制
static function AddOfflineConversions($offline){  
  $GLOBALS['Proxy'] = $GLOBALS['CampaignProxy'];  
  $request = new ApplyOfflineConversionsRequest(); 
   $request->OfflineConversions = $offline;    
return $GLOBALS['CampaignProxy']->GetService()->ApplyOfflineConversions($request);
}

N.B:在向必应发送脱机转换广告之后,查看转换数据(从api文档,这就是原因吗?)

编辑:

请求:

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:ns1="https://bingads.microsoft.com/CampaignManagement/v11">
    <SOAP-ENV:Header>
        <ns1:CustomerAccountId>#########</ns1:CustomerAccountId>
        <ns1:CustomerId>#########</ns1:CustomerId>
        <ns1:DeveloperToken>#########</ns1:DeveloperToken>
        <ns1:UserName/>
        <ns1:Password/>
        <ns1:AuthenticationToken>
            #########
        </ns1:AuthenticationToken>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:ApplyOfflineConversionsRequest>
            <ns1:OfflineConversions>
                <ns1:OfflineConversion>
                    <ns1:ConversionCurrencyCode>USD</ns1:ConversionCurrencyCode>
                    <ns1:ConversionName>Offline Conversion Goal</ns1:ConversionName>
                    <ns1:ConversionTime>2017-08-01T14:00:24</ns1:ConversionTime>
                    <ns1:ConversionValue>1</ns1:ConversionValue>
                    <ns1:MicrosoftClickId>#########</ns1:MicrosoftClickId>
                </ns1:OfflineConversion>
            </ns1:OfflineConversions>
        </ns1:ApplyOfflineConversionsRequest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

响应:

代码语言:javascript
运行
复制
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:TrackingId xmlns:h="https://bingads.microsoft.com/CampaignManagement/v11">
            ##########
        </h:TrackingId>
    </s:Header>
    <s:Body>
        <ApplyOfflineConversionsResponse xmlns="https://bingads.microsoft.com/CampaignManagement/v11">
            <PartialErrors xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>
        </ApplyOfflineConversionsResponse>
    </s:Body>
</s:Envelope>
EN

回答 2

Stack Overflow用户

发布于 2017-08-02 16:02:12

票数 2
EN

Stack Overflow用户

发布于 2021-02-03 09:03:16

在使用https://github.com/BingAds/BingAds-Python-SDK上传脱机转换时,我也面临着同样的问题。campaign_service.ApplyOfflineConversions.

根据响应,有一个空的PartialErros,但数据在Microsoft帐户中不可见。

代码语言:javascript
运行
复制
    offline_conversions=campaign_service.factory.create('ArrayOfOfflineConversion')

    offline_conversion=set_elements_to_none(campaign_service.factory.create('OfflineConversion'))
    # If you do not specify an offline conversion currency code, 
    # then the 'CurrencyCode' element of the goal's 'ConversionGoalRevenue' is used.
    offline_conversion.ConversionCurrencyCode = "INR"
    # The conversion name must match the 'Name' of the 'OfflineConversionGoal'.
    # If it does not match you won't observe any error, although the offline
    # conversion will not be counted.
    offline_conversion.ConversionName = offline_conversion_goal_name
    # The date and time must be in UTC, should align to the date and time of the 
    # recorded click (MicrosoftClickId), and cannot be in the future.
    print("==============time")
    print(datetime.utcnow())
    print(datetime.utcnow() - timedelta(hours=0, minutes=2)) 
    offline_conversion.ConversionTime = (datetime.utcnow() - timedelta(hours=0, minutes=10))
    # offline_conversion.ConversionTime = datetime.utcnow()
    # If you do not specify an offline conversion value, 
    # then the 'Value' element of the goal's 'ConversionGoalRevenue' is used.
    offline_conversion.ConversionValue = 5
    offline_conversion.MicrosoftClickId = "bb3084024ed412a83006e41b6bbf693a"
    # offline_conversion.wc_clear=true
    offline_conversions.OfflineConversion.append(offline_conversion)
    print(offline_conversions)

    # After the OfflineConversionGoal is set up, wait two hours before sending Bing Ads the offline conversions. 
    # This example would not succeed in production because we created the goal very recently i.e., 
    # please see above call to AddConversionGoals. 

    output_status_message("-----\nApplyOfflineConversions:")
    apply_offline_conversions_response = campaign_service.ApplyOfflineConversions(
        OfflineConversions=offline_conversions)
    print(apply_offline_conversions_response)
    output_status_message("PartialErrors:")
    output_array_of_batcherror(apply_offline_conversions_response)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45456447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档