Available options
| Option↕ | Description↕ |
|---|---|
URL_PARAM | Persists 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. |
SESSION | Persists 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:
1
Zonos.init({2
// ... other settings3
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:
- URL parameter - Looks for
zCountryin the URL query string. Also supports legacy parameterscountryandcustomerCountryas fallbacks. - Session storage - If no URL parameter is found, checks
sessionStoragefor thezonos--countrykey. - 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.
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
countryOverrideBehaviorsetting inhelloSettingscontrols how this country selection is persisted.