Posts tagged with google-ads-api

From within a Google Ads script, I'm trying to create a basic line chart as described here: https://developers.google.com/apps-script/reference/charts/line-chart-builder

The data that I'm looking to chart is Date X Clicks.

I'm able to generate the chart with my data from Google Ads, however, Dates are being formatted as Strings and not actual dates within the chart which is causing other issues.

For example, this code will work with my data but formats the dates as strings within the chart:

var dataBuilder = Charts.newDataTable();   dataBuilder.addColumn(Charts.ColumnType.STRING, 'Date'); dataBuilder.addColumn(Charts.ColumnType.NUMBER, 'Clicks'); 

When I try this code, it does not work:

var dataBuilder = Charts.newDataTable();   dataBuilder.addColumn(Charts.ColumnType.DATE, 'Date'); dataBuilder.addColumn(Charts.ColumnType.NUMBER, 'Clicks'); 

I have tried to convert the date data from this: ["2019-09-27",75],["2019-09-29",102],["2019-9-30",112]

To something like this: ["new Date(2019,9,27)",75],["new Date(2019,9,29)",102],["new Date(2019,9,30)",112]

Based on the documentation that I found here: https://developers.google.com/chart/interactive/docs/datesandtimes

But that does not seem to work.

Any suggestions?

About a year ago, Google AdWords changed their name to Google Ads and now they complicated Google Ads API. Their official library doesn't work and I don't know where I should get information from.

My questions:

  1. How I can get all Google Ads scopes like here
  2. How LIST function for Google Ads looks like in JavaScript? (to get basics Google Ads user data) Link

Note:

Doesn't work anymore:

  • gapi.client.load('https://www.googleapis.com/discovery/v1/apis/adwords/v2/rest')
  • gapi.client.load('googleads', 'v3')
  • gapi.client.load('adwords', 'v2')
  • gapi.client.load('https://googleads.googleapis.com/v2/customers')

One working scope for Google Ads:

  • https://www.googleapis.com/auth/adwords

Is there a way to get the campaign performance broken down by segments like age, gender and parental status from the Google Adwords API. I am aware that there are separate reports (Gender Performance Report, Age Range Performance Report etc) with the required stats, but I am looking for a consolidated list. The thing is I am able to create a campaign performance report in the UI broken down by the above-said segments and wonder why I cannot find a similiar report in the list of reports in the API documentation.

I took a look at this answer which says it is not possible but that was in 2016.

I want to develop a webhook for adding leads automatically from google lead form into CRM. Google can call a webhook url to submit such leads.

Refer to the link: https://developers.google.com/google-ads/webhook/docs/overview

This link at microsoft : https://learn.microsoft.com/en-us/aspnet/webhooks/ have mentioned several nuget packages to build webhook receiver but none for google lead form.

Can any one help me to identify how can I build such webhook that can be called through google to add lead automatically into CRM.

TIA.

I am currently trying to import latitude and longitude values from a sheet, into my Google ads campaign through a script that looks like this:

function main() {   var SPREADSHEET_URL = 'https://docs.google.com/spreadsheets/d/17w74flZ3AD7r7wIbAoYYkffUuJfxGB0-a9lhjBStzW4/edit#gid=0';   var spreadsheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);   var sheet = spreadsheet.getActiveSheet();   var data = sheet.getRange("A:E").getValues();   for (i in data) {     if (i == 0) {       continue;       }     var [CampaignName, latitude, longitude, radius, unit] = data[i];     if (CampaignName == "") {       break;     }     else {       var campaignIterator = AdWordsApp.campaigns()         .withCondition("CampaignName CONTAINS_IGNORE_CASE '" + CampaignName +"'")         .get();       while (campaignIterator.hasNext()) {         var campaign = campaignIterator.next();         campaign.addProximity(latitude, longitude, radius, unit);       }     }   } } 

However, when running the script, I keep getting the error "Invalid argument: latitude. Should be of type: number (file Code.gs, line 22)" What am I doing wrong? (also the sheet link is open for anyone, and its a back up so no worries).