Hello,
I have the following report:
report = AdsApp.report('SELECT segments.product_item_id, metrics.cost_micros, metrics.conversions_value,
campaign.name, metrics.conversions, segments.product_custom_attribute4, segments.product_custom_attribute3 FROM shopping_performance_view WHERE
campaign.name REGEXP_MATCH ".*_PPF_.*" AND
campaign.name NOT REGEXP_MATCH ".*_PPF_Y.*" AND metrics.cost_micros > 50000000 AND segments.date DURING LAST_30_DAYS ORDER BY segments.product_item_id ASC');
As you can see I am trying to report on OfferIds while only selecting certain campaigns.
Now i want to sum the values for cost, conversionvalue and conversions for each ID, so that I can calculate the ROAS for each product in this specific set of campaigns and write them to a spreadsheet along with the total conversions.
My initial idea was to save the values from one row into variables, call the next row and compare the IDs but I am afraid this is not going to work in all cases.
I have found this thread on stackoverflow which could be helpful :
https://stackoverflow.com/questions/14446511/most-efficient-method-to-groupby-on-an-array-of-objectsbut since I call the rows individually i dont know how to implement this.
Any help is appreciated :)
Kind regards
Jan