TLDR: Styla can display different content of a specific page for different audience segments. In order to get this working you need to a) provide user’s segment IDs to Styla on your website b) set up an alternative module per one or all segments when creating Styla pages.
Based on segments a user is assigned to, Styla serves content different from the default (no segmentation) version of the page. You create such versions in Styla Editor and assign them to segment IDs.
Styla can use segment data from any provider (Dynamic Yield, Kameleoon, Nosto, Segmentify etc.) as long as segment IDs are provided as described below.
The points 1, 2 and especially 3 below are done by your developers while 4 is done by content creators.
Enter them as a top-level JSON node in the domain's "Theme Settings" tab in Styla Organization Manager at https://admin.styla.com/:
If you don't have an access, Styla will set it up for you. Contact your Customer Success Manager at Styla or simply support@styla.com and pass them the list of your segments. The id field will be used to match Styla content with user's segment on the website while the description field will be displayed in Styla Editor as a label when assigning content to a segment.
You can read more about the Organization Manager here: https://docs.styla.com/managing-styla-accounts
Try to limit the number of your segments used in Styla to 5. Using more segments might result in much longer loading times and will make managing your content in Styla Editor a complex process.
Go to your account's settings and switch this feature on:
This will make Styla Editor display an additional UI element for assigning modules to a segment (details below) and Styla front-end serve multiple versions of the same page depending on which modules are assigned to which segment.
Styla front-end needs to get segment IDs assigned a visitor currently viewing the website to display segment-specific modules. This relies on JavaScript so for no-JS browsers, search engines (and also if no segments provided) the default set of modules will be displayed.
Push segment IDs as an array to Styla's activeSegments hook in the window object, like this:
window.styla = window.styla || {};
window.styla.hooks = window.styla.hooks || [];
window.styla.hooks.push(['activeSegments', () => ['Sgm Lapsed Customer','Sale'], 'data' ]);
The segment IDs need to match the ones passed to Styla in the step 1 above.
You can include this inside a provider-specific logic delivering segments, for instance:
<script>(function() {
var name="nostojs";
window[name]=window[name]||function(cb){(window[name].q=window[name].q||[]).push(cb);};
})();
nostojs(function(api){api.listen('prerender', function(event) {
window.styla = window.styla || {};
window.styla.hooks = window.styla.hooks || [];
window.styla.hooks.push(['activeSegments', () => [event.segments], 'data' ]);
});});</script>
You can render this server-side too to be faster, example:
$segments = $fetchSegments();
<PHP>
window.styla = window.styla || {};
window.styla.hooks = window.styla.hooks || [];
window.styla.hooks.push(['activeSegments', () => [$segments, 'data' ]);
</PHP>
Make sure to deliver visitor's segments no later than in 500ms. Otherwise Styla content might flicker or simply show the default page version instead of the segment-specific modules. For this reason, delivering segments with a server logic is worth considering.
Log in to Styla Editor and use the new UI visible in page's row and select segment per module to make this module visible only to the selected audience segment.
After that you can edit each of the modules as you would do without segmentation on: upload images, update text and links, select products. The row options like width, top spacing, mobile-only and background will influence the modules for any segment.
Using segments limits the number of modules per segments to one, so you won't be able to have multiple modules displayed on a row you use segmentation on.
Once you're done setting up your content, you can preview it as any of the segments included on the page. Select it from the drop-down list top-right of the Preview tab:
Make sure not to overuse the segmentation feature on one page. If you create a page with 10 rows and each of them displaying one module per segment and create mobile-only versions of these rows then such a page will definitely load slowly. It is best to only use segments for crucial content, modules that really need to look different for each of your audience segments.
For every user without an assigned segment, the default version of the page will be displayed. Such users will only see modules from row's "Default" tab and this is why you can't remove such modules. This default page version will also be served to users without JavaScript activated, like search engine bots. As a result, search engines will index default page versions, without segment-specific content, and display them in search results.