Posts under category google-ads-api

I am trying to pull report from google ad manager using API

  report_job = {   'reportQuery': {       'dimensions': ['AD_EXCHANGE_DATE', 'AD_EXCHANGE_COUNTRY_NAME'],       'columns': ['AD_EXCHANGE_AD_REQUESTS', 'AD_EXCHANGE_IMPRESSIONS',                   'AD_EXCHANGE_ESTIMATED_REVENUE','AD_EXCHANGE_AD_ECPM'],       'dateRangeType': 'LAST_WEEK',       'timeZoneType': 'AD_EXCHANGE',  # Run in pacific time       'adxReportCurrency': 'USD'   }   }

I suspect the downloaded report has very wired ECPM and Revenue values. as below

Please help if i am doing something wrong, as the ECPM has to be very low and the revenue as well.

I need some help with the google ad manager API. I am trying to delete a lineitem with the following:

from googleads import ad_manager client = ad_manager.AdManagerClient.LoadFromStorage() def test(id):     line_item_service = client.GetService('LineItemService',version='v202002')     line_item_name = str(id)     statement = (ad_manager.StatementBuilder(version='v202002').Where('OrderId = :OrderId').WithBindVariable('OrderId',app.config['AD_MANAGER']['ORDER_ID']))         response = line_item_service.performLineItemAction(line_item_service.DeleteLineItems(),statement.ToStatement()) 

My problem lies with DeleteLineItems() as I am not sure how to call it correctly. I am not able to find clear usage examples, hence my attempt above. Below are the docs I could find. The error of my current attempt is:

{success: false, error: "<class 'googleads.errors.GoogleAdsValueError'>", message: "Service DeleteLineItems not found"} 

https://developers.google.com/ad-manager/api/reference/v202011/LineItemService.DeleteLineItems https://developers.google.com/ad-manager/api/reference/v202011/LineItemService#performLineItemAction

I need to fetch:

  1. Name of the campaign.
  2. Impressions.
  3. Cost.
  4. Conversation Rate.
  5. Conversions.
  6. Date.
  7. Budget.
  8. Image/Video of this ad.

Can I fetch it all from campaign entity? How?

$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient(); // Creates a query that retrieves all campaigns. $query = 'SELECT [MYLIST]  FROM campaign ORDER BY campaign.name'; // Issues a search stream request. /** @var GoogleAdsServerStreamDecorator $stream */ $stream = $googleAdsServiceClient->searchStream($customerId, $query); // Iterates over all rows in all messages and prints the requested field values for // the campaign in each row. foreach ($stream->iterateAllElements() as $googleAdsRow) {     /** @var GoogleAdsRow $googleAdsRow */     printf(         "Campaign with ID %d and name '%s' was found.%s",         $googleAdsRow->getCampaign()->getId(),         $googleAdsRow->getCampaign()->getName(),         AND SOMETHING HERE         PHP_EOL     ); } 

I want to get Device Targeting Information from Google Ads Api as show in below screen shot:

Currently from what i get from the documentation i am doing this :

string  query = $@"SELECT campaign_criterion.device.type FROM campaign_criterion";       // also tried this query query = $@"SELECT campaign.id, campaign_criterion.device. FROM Device WHERE campaign.id =           {campaignId}";            PagedEnumerable<SearchGoogleAdsResponse, GoogleAdsRow> result =               googleAdsService.Search(customerId.ToString(), query);            foreach (GoogleAdsRow criterionRow in result)             {                 DeviceInfo device = criterionRow.CampaignCriterion.Device;             } 

I have randomly tried many other but i always see NULL in Device i have been able to successfully get Keywords , Ad Schedule View and works fine but cannot seem to get this working any help is appreciated.

I'm getting to Google Ads scripts. I managed to execute this script that pauses a specific campaign but I couldn't apply this to multiple campaigns. Here is what I tried, but it only pauses the first campaign in ("Name IN ['test1', 'test2']"). Could someone help me to achieve this?

function main () {   var campaignIterator = AdsApp.campaigns()     .withCondition("Name IN ['test1', 'test2']").get();   if (campaignIterator.hasNext()) {     var campaign = campaignIterator.next();     campaign.pause();   } }