Geo_Performance_Report getting City Country Region Names

58 views
Skip to first unread message

Roshni Shah

unread,
Oct 9, 2015, 11:47:29 AM10/9/15
to AdWords API Forum
Hello

I have just started integrating Geo_performance_report with my reporting solution. I found that the reports are giving Id's and not Names. Its been told to use LocationCriterionService to find out Names of respective Ids. I am trying to fetch required things for me But somehow I am getting Null exception. I am following LocationCriterionService Documentation given on Google Adwords but not getting through. Kindly help.

 if (reportType == ReportDefinitionReportType.GEO_PERFORMANCE_REPORT)
                    {
                        var selectorq = new Selector();
                        selectorq.fields = new string[] { "canonicalName" };
                       // selectorq.dateRange = new Google.Api.Ads.AdWords.v201506.DateRange
                      //  {
                       //     min = start, //Start date
                       //     max = end // End date
                      //  };
                        var val = //list of ids.;
                        var predicate = new Predicate
                        {
                            field = "CountryCriteriaId", //Filter field (Key)
                            values = val.Split(new[] {','}), //Filter value
                            @operator = PredicateOperator.IN//Filter operator
                        };
                        selectorq.predicates = new Predicate[]
                        {
                            predicate 
                        }
                            ;
                        var location = new LocationCriterionService();
                        location.User = user;                        
                        var dta = location.get(selectorq);
                    }

I am not sure what other information I need to pass still with this to get my results. 

Anthony Madrigal

unread,
Oct 9, 2015, 4:09:28 PM10/9/15
to AdWords API Forum
Hello,

in order to get the location names using the LocationCriterionService, you will need to include the field CanonicalName, not canonicalName in your GET selector. 

We have code examples in our Github library to get you started. It is called LookupLocation and can be found in the Targeting folder. Here is a link to the Java version of the code.

Regards,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages