Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM Personalization Contexthub based on Cookie

Avatar

Level 2

I have a requirement to personalise the content of my site depending on Section selected by the visitor.

My site is currently split into 3 sections SectionA/SectionB/SectionC. Assuming a visitor selects the Section A ,we save this selection in the cookie and have to do the personalization on the basis of the value in this cookie.

I wrote the JS files for 3 sections and able to acheive the personalization by using script reference. But the problem is sections on the site are authorable and if in future author add the section then i have to write JS for it so that it can be referred in the script reference. Can anyone suggest any solution to my use case.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi asaggar

Segmentation should be done based on the audiences rather than the section on the page.

If we have audience based segments then we can apply them to any section of the page. Yes, with the page developments we might need to change the logic of the audiences (cookies in your case) in JS of the segment but that should be done only at one place which would get applied to all the targeted components. Try to code segment in general ways rather than keeping page segment specific.

~kautuk



Kautuk Sahni

View solution in original post

5 Replies

Avatar

Community Advisor

Seems to be classic case of personalization, Your personalized content should be for a specific audience. From what I think:

- You should create a content hub segment for each of your website section.

- Create 3 activities/offers -- one per segment.

- Based on action performed by user, assign it to some segment(based on what rule you defined in step 1).

This should take care of showing content as per user segment.

I could be missing something here. Does this serve the purpose or you need something else

Avatar

Level 2

I have done the same as you have mentioned.

- I have written  3 JavaScript and got them registered in the SegmentEngine  so that I can use them as script reference in the my Segments. It is working fine for me .

Problem for me is Author can create new sections, So consider a use case where author has created a new Section D in that case I have to write JS for that section and get it registered in the SegmentEngine  so that I can use them as script reference in the my Segment for that section .

Writing JS for every section added by the author doesn't seems to me a good option . Is there any other way through which I can achieve  my use cases.

Avatar

Community Advisor

Give every section a name..This should be authorable. So whenever author creates a section, new  name needs to be assigned to it. And segment definition should also use same name..

In terms of code, you can set section name authored and set this value. This should take care of everything.

Avatar

Correct answer by
Administrator

Hi asaggar

Segmentation should be done based on the audiences rather than the section on the page.

If we have audience based segments then we can apply them to any section of the page. Yes, with the page developments we might need to change the logic of the audiences (cookies in your case) in JS of the segment but that should be done only at one place which would get applied to all the targeted components. Try to code segment in general ways rather than keeping page segment specific.

~kautuk



Kautuk Sahni

Avatar

Level 1

please give some example for it.