thank you it works Le vendredi 1 mars 2019 20:34:43 UTC+1, Didier Roy a écrit : > > 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. 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/4cca57f5-1a9a-40a4-a6f4-04955d1e6c86%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.