Documentation > UCP Implementation Guide > Testing

Country Testing

The UCP supports over 100 countries and allows you to set up specific experiences for as many countries as you need. The UCP scripts deliver a user experience based on country using IP routing provided by our content distribution network (Akamai). Naturally this makes it a little more difficult to test the different countries from a typical testing environment. The following mechanisms can be used to test the country experiences from a test environment.

Proxy Testing

There are a number of proxy tools available on the market (many of them free) which will allow you to route the communication from your computer through a proxy in different countries.  This is the most realistic way to test the different country experiences.  However, one major limitation of this is the proxy apps typically don’t support all available countries, so you may not have support for one or more countries you have assigned to the UCP domain.

Country.js Modification

The country.js script is the indicator on the page which tells the UCP script the country where it is running.  The part of the script that enables the location detection is the word “geo” in the call to that script.  That keyword instructs our call to Akamai (CDN) to look up the requesting location via IP lookup and route the call to a country specific location.  However, you can modify this call and point it directly to the country-specific version of the country.js script.  To do this you will change the call from this:

append('evidon-location', cdn + 'geo/country.js', true);

to this:

append('evidon-location', cdn + 'tag-<country code>/country.js', true);

With the “country code” marking being the correct country code for the country you are simulating.  For example, France would be tag-fr.

You can accomplish this by either modifying the script for testing, or there are utilities for some browsers (such as Chrome) which can be used to modify outgoing resource calls without changing the script itself (one example is “Switcheroo”).  That is probably a better option for testing a larger number of countries.

Javascript Location Override

The UCP JavaScript API library includes a call to set the current location.  This is a little tougher to do than changing the domain.  You need to pass in a country object with the correct format.  If you want to do this, please review the JavaScript API documentation for additional details.

Connect with Crownpeak