How to Get Numeric only Values only in Adwords Reports ?

17 views
Skip to first unread message

Arun Jain

unread,
Dec 21, 2016, 2:55:24 AM12/21/16
to AdWords Scripts Forum
Hi All
I am using CAMPAIGN_PERFORMANCE_REPORT to get ConversionRate, ValuePerConversion for Campain report in Adword Script
and I am getting formatted data with % sign and Comma etc. Eg:

--------------------------------------------------------------
|  ConversionRate  |  ValuePerConversion  |
--------------------------------------------------------------
|         2.40%         |             1,250                      |
--------------------------------------------------------------
|         9.20%         |               250                        |
--------------------------------------------------------------
|         7.88%         |             1,987                       |
--------------------------------------------------------------
|        12.40%        |             2,587                       |
--------------------------------------------------------------

Can I get Unformatted data with out % sigh or comma (,) . Eg.

--------------------------------------------------------------
|  ConversionRate  |  ValuePerConversion  |
--------------------------------------------------------------
|         2.40               |             1250                     |
--------------------------------------------------------------
|         9.20               |               250                     |
--------------------------------------------------------------
|         7.88               |             1987                     |
--------------------------------------------------------------
|        12.40              |             2587                     |
--------------------------------------------------------------



Joyce Lava (AdWords Scripts Team)

unread,
Dec 21, 2016, 3:36:38 AM12/21/16
to AdWords Scripts Forum
Hi Arun,

Since these report fields are returned in these formats, you may try to manipulate it on your end after it was returned. Please see the below script to replace the comma (,) and percent (%) signs by "".

 var rows = report.rows();
 
while (rows.hasNext()) {
   
var row = rows.next();
   
var conversionRate = row['ConversionRate'];
   
var valuePerConversion = row['ValuePerConversion'];
   
Logger.log(parseFloat(conversionRate.replace(/%/g, '')) + ',' + parseFloat(valuePerConversion.replace(/,/g, '')) );
 
}

Hope it helps.

Best,
Joyce Lava
AdWords Scripts Team

Arun Jain

unread,
Dec 21, 2016, 5:40:53 AM12/21/16
to AdWords Scripts Forum
Thank you for you reply.
This is what I am doing till now.

row['ConversionRate'].replace("%", "");
row
['ValuePerConversion'].replace("%", "");


I was Updating all script for performance,just thought if its possible to get unformatted data then we can save time doing search replace.

Thanks

Reply all
Reply to author
Forward
0 new messages