2

Is it possible to use personalization on a SXA partial design? I am building a header component and want to use a personalization rule to alternate menu items shown depending on whether or not the user is authenticated. I have disabled caching entirely on the rendering for the menu items, but the partial design seems to cache the rendering per-page.

I'm using Sitecore 8.2 with SXA 1.2 rev 161216

  • Could you add information about you SXA version? – Alan Płócieniak Apr 25 '17 at 6:17
  • @AlanPłócieniak I've updated my question. – Matthew Dresser Apr 25 '17 at 9:43
  • Are you using local page data (under presentation/partial designs/partial design/data/partial designs/partial design/data or global (under site/data)? I am able to set up working POC for both SXA versions but only 1.2 require additional fix if you are using local data instead of global – Alan Płócieniak Apr 25 '17 at 9:59
  • I am using global data for the content - wasn't even aware of being able to place data beneath the Partial Design items! – Matthew Dresser Apr 25 '17 at 10:24
  • Have you tried some basic rules? I used one that checks whether query string parameter is present in the URL. Works without issues. I am trying to find out whether this is incorrect configuration of personalization or some issue in SXA. – Alan Płócieniak Apr 25 '17 at 10:50
5

The scenario is possible to achieve using multiple mechanisms.

1) Sitecore security on items (unauthenticated users will have no way of accessing the pages). SXA fully respects the Sitecore security model and you could simply revoke the read rights to everyone for the restricted items and grant it selectively to the authenticated users. The component will render the items with respect to what the Sitecore API returns.

2) Personalization + navigation filters. (if you want pages to be reachable for unauthorized users just not showing in navigation) Have 2 navigations in your header and show one for authenticated users and another one for anonymous visitors.

Add one or two navigation filters under //Data/Navigation Filters like this:

enter image description here

On the page you want to hide for anonymous visitors check the checkbox to filter the page out:

enter image description here

In the navigation that personalization shows to anonymous visitors pick the "Anonymous visitors" filter:enter image description here

3) Last option requires that you have SXA 1.3 and in this option simply specify the personalization rule on your rendering variant. This allows you to evaluate each item before it's rendered and you can set any personalization rule there:

enter image description here

That means you can have various fields and say e.g.

if this field has that value and user is in this profile card - show if this item is of that template and user is returning - show etc.

1

This issue turned out to be related to a cache setting on the parent rendering, rather than the rendering itself.

Don't forget: if using personalisation, turn off caching. Sitecore does not do this automatically for you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.