Allow users to override the location detected by our IP-to-location service by selecting a different location. Dynamic content will be displayed based on their selection.
For example:
The flag below is displayed based on our IP-to-location service
Select a country to see how the country’s flag is displayed based on your selection:
The location override functionality requires the Trigger Events extension in order to work. Click here to download the extension.
The dynamic content
To create the override option, you will need to create two versions of the content you would like to display for each country:
The versions should be ordered so that If-So will first check the cookie condition so that if the cookie exists, the content will be displayed based on the cookie.
The location selection form
The location selection form can be created using a shortcode. It generates a cookie automatically once the user selects one of the options. The cookie name is chosen by you as part of the shortcode, while the cookie value is a by-product of the location name (as entered in the shortcode).
The following screenshot shows a trigger with 4 dynamic versions:
Versions A & B: Cookie-based content. These versions will be displayed if the user selects “Brazil” or “Mexico” from the locations list.
Versions C &D: Location-based content. These versions will be displayed if the user is located in Mexico or Brazil and doesn’t select a location from the list.
Default version: Will be displayed if the user doesn’t select a location and is not located in Mexico or Brazil.
Setting up the selection dropdown is done using the following shortcode:
[ifso_geo_selection type="select" options="Brazil, Mexico" cookie_name="country-cookie" default-option="Country" button="Select"]
The shortcode above will add a dropdown with all the countries in the world. If you want to display only some countries or different locations like cities or states, you can set it up using the “Options” parameter.
The “options” parameter
The Options Parameter is the place to set the values that will be displayed in the dropdown. These values will also be the values of the cookie that is created when the user selects an option. Possible values for the options parameter:
cookie_name: The name of the cookie that is created when the user selects an option.
type: select / radio
button (optional): Include the Button parameter if you want the form to be submitted upon clicking the button.
Example:
[ifso_geo_selection type="select" options="New York,Paris, London" cookie_name="NAME-YOU-CHOOSE" default-option="Your Location"]
Result:
If you have a large number of locations, we highly recommend using the CSV extension. It can be set up as follows:
The result: If the cookie exists, the content will be displayed based on the cookie. If not, the geolocation condition will be checked (and the content will be displayed accordingly).