AEM Personalization Contexthub based on Cookie | Community
Skip to main content
asaggar
Level 2
August 2, 2017
Solved

AEM Personalization Contexthub based on Cookie

  • August 2, 2017
  • 5 replies
  • 3211 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

5 replies

viveksachdeva
Community Advisor
Community Advisor
August 2, 2017

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

asaggar
asaggarAuthor
Level 2
August 2, 2017

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.

viveksachdeva
Community Advisor
Community Advisor
August 2, 2017

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.

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
August 2, 2017

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
kumar4585
February 13, 2019

please give some example for it.