tmarois/laravel-ads-sdk

DestinationUrlPerformanceReport

dominikraff opened this issue · 14 comments

Is it also possible to geht DestinationUrlPerformanceReport?
I tried this, but it doesn't work.

DestinationUrlPerformanceReportRequest {#646 ▼
+Aggregation: "Daily"
+Columns: array:2 [▶]
+Filter: null
+Scope: DestinationUrlPerformanceReportScope {#645 ▶}
+Time: ReportTime {#644 ▶}
+ExcludeColumnHeaders: null
+ExcludeReportFooter: null
+ExcludeReportHeader: null
+Format: "Csv"
+Language: null
+ReportName: "Destination URl Performance Report"
+ReturnOnlyCompleteData: false
}

Always this error occurs:

SoapFault Invalid client data. Check the SOAP fault details for more information COPY Application frames (9) All frames (78) 77 SoapFault …/vendor/grayscale/laravel-ads-sdk/src/Services/BingAds/Reports.php123

That's my code, its nearly the same like AdGroupReport

public function buildDestinationUrlReport()
{
$report = new DestinationUrlPerformanceReportRequest();
$report->ReportName = 'Destination URl Performance Report';
$report->Format = ReportFormat::Csv;
$report->ReturnOnlyCompleteData = false;
$report->Aggregation = ReportAggregation::Daily;
$report->Scope = new DestinationUrlPerformanceReportScope();
$report->Scope->AccountIds = [$this->service->getClientId()];
$report->Time = new ReportTime();
$report->Time->CustomDateRangeStart = new Date();
$report->Time->CustomDateRangeStart->Day = date('d',strtotime($this->dateRange[0]));
$report->Time->CustomDateRangeStart->Month = date('m',strtotime($this->dateRange[0]));
$report->Time->CustomDateRangeStart->Year = date('Y',strtotime($this->dateRange[0]));
$report->Time->CustomDateRangeEnd = new Date();
$report->Time->CustomDateRangeEnd->Day = date('d',strtotime($this->dateRange[1]));
$report->Time->CustomDateRangeEnd->Month = date('m',strtotime($this->dateRange[1]));
$report->Time->CustomDateRangeEnd->Year = date('Y',strtotime($this->dateRange[1]));
$report->Columns = array (
AdGroupPerformanceReportColumn::TimePeriod,
AdGroupPerformanceReportColumn::AccountId
);
$encodedReport = new SoapVar($report, SOAP_ENC_OBJECT, 'DestinationUrlPerformanceReportRequest', $this->serviceProxy->GetNamespace());
$reportRequestId = $this->submitGenerateReport($encodedReport)->ReportRequestId;
return (new ReportDownload($this->serviceProxy, $reportRequestId));
}

What i have made new ist the DestinationUrlPerformanceReportScope, because it wasn't there.

namespace Microsoft\BingAds\V12\Reporting;
{
final class DestinationUrlPerformanceReportScope
{
/**
* The identifier of the account that the ad group belongs to.
* @var integer
/
public $AccountId;
/
*
* The identifier of the campaign that the ad group belongs to.
* @var integer
/
public $CampaignId;
/
*
* The identifier of the ad group to limit the scope to.
* @var integer
*/
public $AdGroupId;
}
}

@dominikraff Looks like it was due to required fields. I was able to get it working using below:

  • Account Name
  • Campaign Name
  • TimePeriod
  • DestinationUrl

https://docs.microsoft.com/en-us/bingads/reporting-service/destinationurlperformancereportcolumn?view=bingads-12#requiredcolumns

     $report->Columns = array (
                DestinationUrlPerformanceReportColumn::TimePeriod,
                DestinationUrlPerformanceReportColumn::AccountName,
                DestinationUrlPerformanceReportColumn::AccountId,
                DestinationUrlPerformanceReportColumn::CampaignName,
                DestinationUrlPerformanceReportColumn::Clicks,
                DestinationUrlPerformanceReportColumn::Impressions,
                DestinationUrlPerformanceReportColumn::Spend,
                DestinationUrlPerformanceReportColumn::Conversions,
                DestinationUrlPerformanceReportColumn::Revenue,
                DestinationUrlPerformanceReportColumn::DestinationUrl
            );

Also use, AccountThroughAdGroupReportScope instead of DestinationUrlPerformanceReportScope That is what they request in the SDK.

Note: in my test, I was not able to see destination url, it was blank for me, let me know if you get yours to show, unless its something with the account I was testing in.

If you find anything useful, I am open to collabration and pull request to improve this SDK.

Thanks!

If you use the field: DestinationUrlPerformanceReportColumn::FinalUrl you can see the url, so it does work!

Thanks!

If you use the field: DestinationUrlPerformanceReportColumn::FinalUrl you can see the url, so it does work!

Awesome. Thank you or that. I will have to try it on my project. Let me know if you find anything else useful we can include in this SDK and make it more seamless. Bing is a challenge to work with, that's why I originally built this to make it a lot easier to get data without the hassle of working with all the different sources.

Would be nice, if you implement it.

The ads-sdk for laravel is awesome. Yeah, bing is a challenge, Google is a challenge and facebook to. So it it's perfekt! :) 👍

@dominikraff Thanks! – I will implement this in the next update.

@dominikraff Checkout the recent release 1.2.9 added a bunch of new reports for bing/google. Including final url report.

Hello, @dominikraff I will look into this and get back to you. It looks like you're trying to use a newer version of the googleads api. I will run some tests to see if it's still compatible.

@dominikraff I have pushed a new release version 1.2.11 this includes the new google ads API version 40. Let me know if that solved your issue.