In a recent project I completed, the requirements were
1) to show flags of certain South American countries on the splash page (site.com).
When the visitor clicks Brasil or Argentina or Espana, he/she should be taken to the corresponding country "homepage" i.e., site.com/brasil or site.com/argentina or site.com/espana.
Clicking on any of the other countries should take them to site.com/home.
2) to be able to output elements based on
- selected country or not the selected country
- whether the selected country is Brasil/Argentina/Espana or not
This can be done by
1) creating a cookie named say,
actioncoach_visitorcountry and setting its value equal to the selected country using JS
2) creating a custom
Visitor Country condition that returns true or false depending on the value in the cookie
thereby allowing the site owner to output any element per the requirements.
This members-only tutorial provides the steps covering how I've set up the above. You may want to treat this as a general guide, try to understand how the code works, and implement it whilst making any necessary changes per your project's requirements.
Warning: Cookie-based approach will not work with Varnish or other type of caching in place. You need to be able to exclude the cookie from the cache. With Flywheel where my client's site is hosted, we have to send them a support ticket and they will take care of it.
Edit the splash page with Oxygen.
Add a Code Block.
PHP & HTML:
<?php // echo "hello world!"; ?>
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.