#2 Location-based content and dynamic content from CSV
Show content (any content) based on the user’s location. Use a standard If-So trigger with the geolocation condition or use the CSV extension if you have many different versions.
Conditions/features in use:The Geolocation Condition & The CSV Extension
We created a CSV file with a list of all 249 countries, their names, and flags (the file is available for you to download and use on your site). We used our CSV extension to upload the file and display the column’s content (the column with the flags).
Since we wanted to create 249 different versions of content (one version per country), we chose to use our CSV extension instead of creating a standard if-then dynamic trigger. The CSV extension was built to add and manage thousands of different versions with ease and with minimal effect on the loading speed.
1) We created a new “If-So Bulk”, and uploaded the pre-made countries’ flags CSV file that you can download from our site. After uploading the file, it is editable directly from the site.
This is how it looks:
2) We pasted the shortcode that displays the content of column C on the page:
Display a value of any query parameter using a simple shortcode.
Conditions/features in use:The query-string DKI shortcode
👑 {YOUR NAME} is awesome!👑
Fill in your name to see it in action
The query string DKI shortcode displays the value of any parameter in the URL. You can set fallback content displayed when the parameter doesn’t exist in the URL.
#4 Segment users & allow users to select their intrests
Segment users into audiences and show content accordingly. Segmentation can be done based on the user interaction with the site or based on the user selection, as in the following example.
Conditions/features in use: Audiences & User Self-selection Form Extension:
What is your favorite page builder?
Assign users into audiences when an If-So condition is met or when they visit a certain page. You can then show audience-based content when the user browses different pages on your site.
Alternatively, use the audience Self-selection Form Extension to allow users to assign themselves to an audience.
Step 1: Creating the audiences On the WordPress dashboard, under If-So > Audiences, we clicked “add a new audience” and created three audiences: “Gutenberg”, “Elementor”, and “Other”.
Step 2: Creating the self-selection form Still, on the audiences page (If-So > Audience on your dashboard), we used the self-selection form generator to generate the shortcode that will show the form and paste the shortcode on the page.
Selecting the form type – selection form (as in our example), or radio buttons.
Reloading the page after the user selection or assigning users to an audience in the background using Ajax (this option is useful if you want to use several selection fields on the same page).
Redirection – choose where to redirect users after form submission.
And more…
Step 3: Creating a trigger with the audience condition We created a dynamic trigger with four different versions. One version for each audience, and one version as the default content displayed if the visitor hasn’t selected a preference.
Any If-So trigger can be displayed as a pop-up by adding a simple parameter to its shortcode. In this example, we used the Page URL condition (IF: URL > Contains > ?tip=yes) to trigger the first pop-up and to add a cookie to the user’s browser while that happens.
When the page loads for the 2nd time, we use the cookie condition to show the 2nd pop-up if the cookie exists in the user’s browser and remove the cookie so that the pop-up will not be displayed again.
How we did it: We created a trigger with the content of the pop-ups as the dynamic versions and set the trigger’s content to be displayed as a pop-up.
Displaying the trigger’s content as a pop-up
To make the trigger’s content appear as a pop-up, we installed the Trigger Events Extension and added two parameters to the triggers’ shortcode: ajax=”yes” and display=”modal”.
As you can see in the shortcode, we also included the parameter closebtn=’#IfsoModalClose’. Adding the parameter overrides the default pop-up closing functionality of closing by clicking the background or the small “X” that appears at the top right corner. Instead, closing the model is done by clicking an element with the ID set as the parameter value.
The trigger
Pop-up #1
Pop-up #1 is displayed based on the page URL condition (If: Page URL > Contains > ?tips=yes Then: Show the dynamic version of pop-up #1).
In addition to the content of the pop-up, we included an If-So shortcode that adds a cookie with the name “tips” and the value “2”:
The shortcode allows you to assign a cookie with any name and value of your choice.
Here’s a screenshot of how it looks on our side:
Pop-up #2
Pop-up #2 is displayed based on the cookie assigned when pop-up #1 was displayed (If: Cookie > Name is “tips” and value is “2” Then: Show tip #2).
Since If-So checks the conditions based on their order in the trigger, from top to bottom, we dragged the version of pop-up #2 to be above the version of pop-up #1. In other words, if the cookie “tips”, cookie value “2” exists in the user’s browser, pop-up #2 is displayed; if not, then If-So checks the next condition, which is if Page URL > Contains > ?tips=yes.
Similar to what we did in the first version, we included the cookie shortcode again, this time to replace the cookie value from “2” to “3”.
Since we don’t want to keep showing pop-up #2 if the user revisits the page, we have set another version and placed it above the version of pop-up #2. The version doesn’t consist of content, only a shortcode that removes the cookie we have set in the previous version:
[ifso-remove-cookie name='tips']
Default version
We left the default version blank since we don’t want the pop-up to be displayed if none of the conditions are met.
Apply a discount if a user clicks a certain element (or elements)
Conditions/features in use:Cookie (or page URL) & Trigger Events Extension
Click the genie lamp once, twice, thrice… After the third click, the hidden discount will be available to you, and you’ll be automatically redirected to the plans page.
No coding is required. The clickable element can be made using our “Assign a cookie” wrapping shortcode, and the custom prices are displayed using the cookie condition.
We used our “Assing a cookie on click” shortcode to wrap the image of the genie lamp. We set the shortcode to assign a cookie with the name “genie” and the value “yes” after 3 clicks. This redirects the user to the plans page. You can see the shortcode and the parameters we used below:
We created a new If-So trigger with a cookie condition: If:Cookie name > genie & Cookie Value > yes, exist in the user’s browser; Then: Show the custom prices