Hi All
I am trying to get hotel performance report using below code and get this
error :
PHP Fatal error: Call to undefined method
Google\Ads\GoogleAds\V0\Services\GoogleAdsRow::getHotelCheckInDayOfWeek()
in
/home/reports/gha/google-ads-php/examples/Reporting/GetHotelAdsPerformance.php
on line 132
line 132 is $googleAdsRow->getHotelCheckInDayOfWeek()
Does anybody has a working example of how to get segment values from the
query results?
thanks
public static function runExample(GoogleAdsClient $googleAdsClient,
$customerId)
{
$googleAdsServiceClient =
$googleAdsClient->getGoogleAdsServiceClient();
// Creates a query that retrieves hotel-ads statistics for each
campaign and ad group.
// Returned statistics will be segmented by the check-in day of
week and length of stay.
$query =
"SELECT campaign.id, "
. "campaign.advertising_channel_type, "
. "ad_group.id, "
. "ad_group.status, "
. "metrics.impressions, "
. "metrics.hotel_average_lead_value_micros, "
. "segments.hotel_check_in_day_of_week, "
. "segments.hotel_length_of_stay "
. "FROM hotel_performance_view "
. "WHERE segments.date DURING LAST_7_DAYS "
. "AND campaign.advertising_channel_type = 'HOTEL' "
. "AND ad_group.status = 'ENABLED' "
. "ORDER BY metrics.impressions DESC "
. "LIMIT 50";
// Issues a search request by specifying page size.
$response =
$googleAdsServiceClient->search($customerId, $query,
['pageSize' => self::PAGE_SIZE]);
// Iterates over all rows in all pages and prints the requested
field values for each row.
foreach ($response->iterateAllElements() as $googleAdsRow) {
/** @var GoogleAdsRow $googleAdsRow */
// Note: A mapping of enum names to values for days of week can
be found at
// DayOfWeek.php.
printf(
"Ad group ID %d in campaign ID %d "
. "with hotel check-in on %d and %d day(s) of stay "
. "had %d impression(s) and %d average lead value (in
micros) "
. "during the last 7 days.%s",
$googleAdsRow->getAdGroup()->getId()->getValue(),
$googleAdsRow->getCampaign()->getId()->getValue(),
$googleAdsRow->getHotelCheckInDayOfWeek(),
$googleAdsRow->getHotelLengthOfStay()->getValue(),
$googleAdsRow->getMetrics()->getImpressions()->getValue(),
$googleAdsRow->getMetrics()->getHotelAverageLeadValueMicros()->getValue(),
PHP_EOL
);
}
}
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/df280fbe-ac2a-4255-9470-3d321b0ac387%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.