DOCS

Country override behavior

Country override behavior

Control how Hello remembers a shopper's selected country.

When a shopper selects a different country in the Hello widget, Zonos needs to remember that selection as the shopper navigates your site. The countryOverrideBehavior setting in helloSettings controls how this country selection is persisted.

Available options 

OptionDescription
URL_PARAMPersists the selected country in the URL query string as ?zCountry=XX. This allows country-specific URLs to be shared and bookmarked. The URL is updated using window.history.replaceState() without a page reload.
SESSIONPersists the selected country in the browser's session storage under the key zonos--country. The selection is maintained as the shopper navigates but clears when the browser tab or session ends.

The default value is URL_PARAM.

Configure country override behavior 

Set the countryOverrideBehavior property in the helloSettings of your Zonos.init call:

1Zonos.init({
2 // ... other settings
3 helloSettings: {
4 countryOverrideBehavior: "URL_PARAM",
5 },
6});

When to use each option 

URL_PARAM

  • You want shoppers to share country-specific links with others.
  • You want search engines to index country-specific versions of your pages.
  • You want the selected country to survive page refreshes.

SESSION

  • You prefer clean URLs without query parameters.
  • You don't need country selection to persist beyond the current browser session.
  • Your site has URL-sensitive logic that may conflict with additional query parameters.

How country detection works 

Hello checks for the selected country in the following order:

  1. URL parameter - Looks for zCountry in the URL query string. Also supports legacy parameters country and customerCountry as fallbacks.
  2. Session storage - If no URL parameter is found, checks sessionStorage for the zonos--country key.
  3. Geolocation - If neither is set, Hello uses the shopper's detected location.

Regardless of which countryOverrideBehavior you choose, the country is always saved to session storage when a shopper makes a selection. The setting controls whether the URL is also updated.

Book a demo

Was this page helpful?