Country name and ISO_3166-1 country codes

6,237 views
Skip to first unread message

Aduffy

unread,
Oct 29, 2009, 3:31:37 PM10/29/09
to google-analytics-api - GA Data Export API
Its unfortunate that the API does not return a ISO_3166-1 country
code in any way. This is compounded by the fact that the country names
are not returned in any ISO standard format..

For example ga:country will return "Russia" where the ISO indicates it
should be "Russian Federation"

There are many other cases like this
Google / ISO_3166-1_alpha-2 ( http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
Russia / Russian Federation
South Korea / Korea, Republic of
Libya / Libyan Arab Jamahiriya

To name a few..

If some one could post a complete list of Country names as returned by
Google along with the correct country code that would be extremely
helpful!!


Aduffy

unread,
Oct 29, 2009, 4:14:30 PM10/29/09
to google-analytics-api - GA Data Export API
OK here is a "Partial" non confirmed list I have started. I started
off with the ISO data from my wikipedia link, and then cross
referenced from a list of all countries that have ever visited my
site. That list was only 172 countries so is in no way complete.

I replace the ISO names with the names Google provides in ga:country

(in PHP) :-)

$_country['notset'] ="(not set)";
$_country['AF'] ="Afghanistan";
$_country['AX'] ="Åland Islands";
$_country['AL'] ="Albania";
$_country['DZ'] ="Algeria";
$_country['AS'] ="American Samoa";
$_country['AD'] ="Andorra";
$_country['AO'] ="Angola";
$_country['AI'] ="Anguilla";
$_country['AQ'] ="Antarctica";
$_country['AG'] ="Antigua and Barbuda";
$_country['AR'] ="Argentina";
$_country['AM'] ="Armenia";
$_country['AW'] ="Aruba";
$_country['AU'] ="Australia";
$_country['AT'] ="Austria";
$_country['AZ'] ="Azerbaijan";
$_country['BS'] ="Bahamas";
$_country['BH'] ="Bahrain";
$_country['BD'] ="Bangladesh";
$_country['BB'] ="Barbados";
$_country['BY'] ="Belarus";
$_country['BE'] ="Belgium";
$_country['BZ'] ="Belize";
$_country['BJ'] ="Benin";
$_country['BM'] ="Bermuda";
$_country['BT'] ="Bhutan";
$_country['BO'] ="Bolivia, Plurinational State of";
$_country['BA'] ="Bosnia and Herzegovina";
$_country['BW'] ="Botswana";
$_country['BV'] ="Bouvet Island";
$_country['BR'] ="Brazil";
$_country['IO'] ="British Indian Ocean Territory";
$_country['BN'] ="Brunei Darussalam";
$_country['BG'] ="Bulgaria";
$_country['BF'] ="Burkina Faso";
$_country['BI'] ="Burundi";
$_country['KH'] ="Cambodia";
$_country['CM'] ="Cameroon";
$_country['CA'] ="Canada";
$_country['CV'] ="Cape Verde";
$_country['KY'] ="Cayman Islands";
$_country['CF'] ="Central African Republic";
$_country['TD'] ="Chad";
$_country['CL'] ="Chile";
$_country['CN'] ="China";
$_country['CX'] ="Christmas Island";
$_country['CC'] ="Cocos (Keeling) Islands";
$_country['CO'] ="Colombia";
$_country['KM'] ="Comoros";
$_country['CG'] ="Congo";
$_country['CD'] ="Congo, The Democratic Republic of the";
$_country['CK'] ="Cook Islands";
$_country['CR'] ="Costa Rica";
$_country['CI'] ="Côte d'Ivoire";
$_country['HR'] ="Croatia";
$_country['CU'] ="Cuba";
$_country['CY'] ="Cyprus";
$_country['CZ'] ="Czech Republic";
$_country['DK'] ="Denmark";
$_country['DJ'] ="Djibouti";
$_country['DM'] ="Dominica";
$_country['DO'] ="Dominican Republic";
$_country['EC'] ="Ecuador";
$_country['EG'] ="Egypt";
$_country['SV'] ="El Salvador";
$_country['GQ'] ="Equatorial Guinea";
$_country['ER'] ="Eritrea";
$_country['EE'] ="Estonia";
$_country['ET'] ="Ethiopia";
$_country['FK'] ="Falkland Islands [Islas Malvinas]";
$_country['FO'] ="Faroe Islands";
$_country['FJ'] ="Fiji";
$_country['FI'] ="Finland";
$_country['FR'] ="France";
$_country['GF'] ="French Guiana";
$_country['PF'] ="French Polynesia";
$_country['TF'] ="French Southern Territories";
$_country['GA'] ="Gabon";
$_country['GM'] ="Gambia";
$_country['GE'] ="Georgia";
$_country['DE'] ="Germany";
$_country['GH'] ="Ghana";
$_country['GI'] ="Gibraltar";
$_country['GR'] ="Greece";
$_country['GL'] ="Greenland";
$_country['GD'] ="Grenada";
$_country['GP'] ="Guadeloupe";
$_country['GU'] ="Guam";
$_country['GT'] ="Guatemala";
$_country['GG'] ="Guernsey";
$_country['GN'] ="Guinea";
$_country['GW'] ="Guinea-Bissau";
$_country['GY'] ="Guyana";
$_country['HT'] ="Haiti";
$_country['HM'] ="Heard Island and McDonald Islands";
$_country['VA'] ="Holy See (Vatican City State)";
$_country['HN'] ="Honduras";
$_country['HK'] ="Hong Kong";
$_country['HU'] ="Hungary";
$_country['IS'] ="Iceland";
$_country['IN'] ="India";
$_country['ID'] ="Indonesia";
$_country['IR'] ="Iran, Islamic Republic of";
$_country['IQ'] ="Iraq";
$_country['IE'] ="Ireland";
$_country['IM'] ="Isle of Man";
$_country['IL'] ="Israel";
$_country['IT'] ="Italy";
$_country['JM'] ="Jamaica";
$_country['JP'] ="Japan";
$_country['JE'] ="Jersey";
$_country['JO'] ="Jordan";
$_country['KZ'] ="Kazakhstan";
$_country['KE'] ="Kenya";
$_country['KI'] ="Kiribati";
$_country['KP'] ="South Korea";
$_country['KR'] ="North Korea";
$_country['KW'] ="Kuwait";
$_country['KG'] ="Kyrgyzstan";
$_country['LA'] ="Lao People's Democratic Republic";
$_country['LV'] ="Latvia";
$_country['LB'] ="Lebanon";
$_country['LS'] ="Lesotho";
$_country['LR'] ="Liberia";
$_country['LY'] ="Libya";
$_country['LI'] ="Liechtenstein";
$_country['LT'] ="Lithuania";
$_country['LU'] ="Luxembourg";
$_country['MO'] ="Macao";
$_country['MK'] ="Macedonia [FYROM]";
$_country['MG'] ="Madagascar";
$_country['MW'] ="Malawi";
$_country['MY'] ="Malaysia";
$_country['MV'] ="Maldives";
$_country['ML'] ="Mali";
$_country['MT'] ="Malta";
$_country['MH'] ="Marshall Islands";
$_country['MQ'] ="Martinique";
$_country['MR'] ="Mauritania";
$_country['MU'] ="Mauritius";
$_country['YT'] ="Mayotte";
$_country['MX'] ="Mexico";
$_country['FM'] ="Micronesia, Federated States of";
$_country['MD'] ="Moldova, Republic of";
$_country['MC'] ="Monaco";
$_country['MN'] ="Mongolia";
$_country['ME'] ="Serbia and Montenegro";
$_country['MS'] ="Montserrat";
$_country['MA'] ="Morocco";
$_country['MZ'] ="Mozambique";
$_country['MM'] ="Myanmar [Burma]";
$_country['NA'] ="Namibia";
$_country['NR'] ="Nauru";
$_country['NP'] ="Nepal";
$_country['NL'] ="Netherlands";
$_country['AN'] ="Netherlands Antilles";
$_country['NC'] ="New Caledonia";
$_country['NZ'] ="New Zealand";
$_country['NI'] ="Nicaragua";
$_country['NE'] ="Niger";
$_country['NG'] ="Nigeria";
$_country['NU'] ="Niue";
$_country['NF'] ="Norfolk Island";
$_country['MP'] ="Northern Mariana Islands";
$_country['NO'] ="Norway";
$_country['OM'] ="Oman";
$_country['PK'] ="Pakistan";
$_country['PW'] ="Palau";
$_country['PS'] ="Palestinian Territories";
$_country['PA'] ="Panama";
$_country['PG'] ="Papua New Guinea";
$_country['PY'] ="Paraguay";
$_country['PE'] ="Peru";
$_country['PH'] ="Philippines";
$_country['PN'] ="Pitcairn";
$_country['PL'] ="Poland";
$_country['PT'] ="Portugal";
$_country['PR'] ="Puerto Rico";
$_country['QA'] ="Qatar";
$_country['RE'] ="Réunion";
$_country['RO'] ="Romania";
$_country['RU'] ="Russia";
$_country['RW'] ="Rwanda";
$_country['BL'] ="Saint Barthélemy";
$_country['SH'] ="Saint Helena";
$_country['KN'] ="Saint Kitts and Nevis";
$_country['LC'] ="Saint Lucia";
$_country['MF'] ="Saint Martin";
$_country['PM'] ="Saint Pierre and Miquelon";
$_country['VC'] ="Saint Vincent and the Grenadines";
$_country['WS'] ="Samoa";
$_country['SM'] ="San Marino";
$_country['ST'] ="Sao Tome and Principe";
$_country['SA'] ="Saudi Arabia";
$_country['SN'] ="Senegal";
$_country['RS'] ="Serbia";
$_country['SC'] ="Seychelles";
$_country['SL'] ="Sierra Leone";
$_country['SG'] ="Singapore";
$_country['SK'] ="Slovakia";
$_country['SI'] ="Slovenia";
$_country['SB'] ="Solomon Islands";
$_country['SO'] ="Somalia";
$_country['ZA'] ="South Africa";
$_country['GS'] ="South Georgia and the South Sandwich Islands";
$_country['ES'] ="Spain";
$_country['LK'] ="Sri Lanka";
$_country['SD'] ="Sudan";
$_country['SR'] ="Suriname";
$_country['SJ'] ="Svalbard and Jan Mayen";
$_country['SZ'] ="Swaziland";
$_country['SE'] ="Sweden";
$_country['CH'] ="Switzerland";
$_country['SY'] ="Syrian Arab Republic";
$_country['TW'] ="Taiwan";
$_country['TJ'] ="Tajikistan";
$_country['TZ'] ="Tanzania, United Republic of";
$_country['TH'] ="Thailand";
$_country['TL'] ="Timor-Leste";
$_country['TG'] ="Togo";
$_country['TK'] ="Tokelau";
$_country['TO'] ="Tonga";
$_country['TT'] ="Trinidad and Tobago";
$_country['TN'] ="Tunisia";
$_country['TR'] ="Turkey";
$_country['TM'] ="Turkmenistan";
$_country['TC'] ="Turks and Caicos Islands";
$_country['TV'] ="Tuvalu";
$_country['UG'] ="Uganda";
$_country['UA'] ="Ukraine";
$_country['AE'] ="United Arab Emirates";
$_country['GB'] ="United Kingdom";
$_country['US'] ="United States";
$_country['UM'] ="United States Minor Outlying Islands";
$_country['UY'] ="Uruguay";
$_country['UZ'] ="Uzbekistan";
$_country['VU'] ="Vanuatu";
$_country['VE'] ="Venezuela, Bolivarian Republic of";
$_country['VN'] ="Viet Nam";
$_country['VG'] ="British Virgin Islands";
$_country['VI'] ="U.S. Virgin Islands";
$_country['WF'] ="Wallis and Futuna";
$_country['EH'] ="Western Sahara";
$_country['YE'] ="Yemen";
$_country['ZM'] ="Zambia";
$_country['ZW'] ="Zimbabwe";

Nick

unread,
Oct 31, 2009, 4:59:04 PM10/31/09
to google-analytics-api - GA Data Export API
Great point. Could you add it as a new feature request to be able to
get this data directly form the API. I'm sure a few other developers
would also want this.

-Nick

On Oct 29, 12:31 pm, Aduffy wrote:
> Its unfortunate that the API does not return a  ISO_3166-1 country
> code in any way. This is compounded by the fact that the country names
> are not returned in any ISO standard format..
>
> For example ga:country will return "Russia" where the ISO indicates it
> should be "Russian Federation"
>
> There are many other cases like this
> Google / ISO_3166-1_alpha-2 (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)

Vincent

unread,
Dec 20, 2009, 7:53:56 AM12/20/09
to google-analytics-api - GA Data Export API
To use the list from Aduffy with Geo Maps API vizualisation
* for dataMode option 'markers': set the value of the country to
country_code + country_name, e.g.: 'BE Belgium'
* for dataMode option 'regions': set the value of the country to
country_name only, e.g.: 'Belgium'


*corrections to the list:

$_country['CG'] ="Congo - Brazzaville"; //instead of "Republic of the
Congo";
$_country['CD'] ="Congo - Kinshasa"; //instead of "The Democratic
Republic of the Congo";

Vincent

unread,
Dec 30, 2009, 9:25:35 AM12/30/09
to google-analytics-api - GA Data Export API
Reply all
Reply to author
Forward
0 new messages