BingAds / BingAds-PHP-SDK

Other
56 stars 45 forks source link

CampaignPerformanceReportRequest works incorrect #99

Closed valetanddama closed 5 years ago

valetanddama commented 5 years ago

I have this xml for get "spend" value for a campaign:

<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header xmlns="https://bingads.microsoft.com/Reporting/v12">
        <Action mustUnderstand="1">SubmitGenerateReport</Action>
        <AuthenticationToken i:nil="false">{{ .AccessToken }}</AuthenticationToken>
        <CustomerAccountId i:nil="false">{{ .AccountID }}</CustomerAccountId>
        <CustomerId i:nil="false">{{ .AccountID }}</CustomerId>
        <DeveloperToken i:nil="false">{{ .DeveloperToken }}</DeveloperToken>
    </s:Header>
    <s:Body>
        <SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v12">
            <ReportRequest i:nil="false" i:type="CampaignPerformanceReportRequest">
                <Format i:nil="false">Xml</Format>
                <ReportName i:nil="false">Report</ReportName>
                <ReturnOnlyCompleteData i:nil="false">true</ReturnOnlyCompleteData>
                <Aggregation>Summary</Aggregation>
                <Columns i:nil="false">
                    <CampaignPerformanceReportColumn>CampaignId</CampaignPerformanceReportColumn>
                    <CampaignPerformanceReportColumn>Clicks</CampaignPerformanceReportColumn>
                    <CampaignPerformanceReportColumn>Spend</CampaignPerformanceReportColumn>
                </Columns>
                <Scope i:nil="false">
                    <AccountIds i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
                        <a1:long>{{ .AccountID }}</a1:long>
                    </AccountIds>
                    <Campaigns i:nil="false">
                        <CampaignReportScope>
                            <AccountId>{{ .AccountID }}</AccountId>
                            <CampaignId>{{ .CampaignID }}</CampaignId>
                        </CampaignReportScope>
                    </Campaigns>
                </Scope>
                <Time i:nil="false">
                    <PredefinedTime i:nil="false">Yesterday</PredefinedTime>
                    <ReportTimeZone i:nil="false">GreenwichMeanTimeDublinEdinburghLisbonLondon</ReportTimeZone>
                </Time>
            </ReportRequest>
        </SubmitGenerateReportRequest>
    </s:Body>
</s:Envelope>

but in a report I get statistics for all campaigns. Also I try to set timezone "GreenwichMeanTimeDublinEdinburghLisbonLondon" in xml, but in report I get value in header TimeZone="(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius" - that is timezone of my account. What is the problem?

I took example from this page https://docs.microsoft.com/en-us/bingads/reporting-service/submitgeneratereport?view=bingads-12

eric-urban commented 5 years ago

@valetanddama please remove AccountIds and try again.

<AccountIds i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <a1:long>{{ .AccountID }}</a1:long>
</AccountIds>

Per the doc:

"The report scope includes a union of the included AccountIds and Campaigns elements."

I hope this helps!