Hello,
Thanks for reading my post. I am sure I am doing something really obviously wrong but any help would be appreciated.
The code giving me problems is below:
function getFilteredShoppingPerfView(daysAgo){
var today = new Date();
var daysAgo = new Date(today.getFullYear(), today.getMonth(), today.getDate() - daysAgo);
var dateFrom = Utilities.formatDate(daysAgo, AdWordsApp.currentAccount().getTimeZone(), 'yyyyMMdd');
var dateTo = Utilities.formatDate(today, AdWordsApp.currentAccount().getTimeZone(), 'yyyyMMdd');
let fromDate = ' 2023-01-01';
let toDate = ' 2023-10-10';
var query =
'SELECT segments.product_item_id, segments.product_custom_attribute3, segments.product_title,metrics.impressions, metrics.clicks, metrics.ctr, metrics.cost_micros, metrics.conversions, metrics.conversions_value ' +
'FROM shopping_performance_view ' +
'BETWEEN' + fromDate + toDate
var products = [];
var count = 0;
//fetch the report from api
var report = AdWordsApp.report(query);
var rows = report.rows();
while (rows.hasNext()){
var row = rows.next();
Whenever i run the above, i get the following error:
QueryError.UNEXPECTED_INPUT: Error in query: unexpected input BETWEEN.
at getFilteredShoppingPerfView (Code:39:17)
at main (Code:14:18)
I checked my GAQL query in the Query validator tool and it shows valid query
as shown in attached screenshot.
I am thinking the issue is an incorrect space or semicolon somewhere?
Thanks again in advance for helping!
Jay