aem client context customisation

24
Client Context Customization in AEM (By Ankit Gubrani)

Upload: ankit-gubrani

Post on 07-Jul-2015

756 views

Category:

Software


0 download

DESCRIPTION

Custom client context store AEM - This files birefs you about content personalization in web and tells you how to achive content personalization in AEM/CQ.

TRANSCRIPT

Page 1: AEM Client Context Customisation

Client Context Customization in AEM(By Ankit Gubrani)

Page 2: AEM Client Context Customisation

500 different people go to Amazon.com and each user sees a different version of the home page.

How come?

Page 3: AEM Client Context Customisation

It's Personalized

Page 4: AEM Client Context Customisation

What is Content Perzonalisation ?

Page 5: AEM Client Context Customisation

Content Personalization in short means delivering the Right Content to the Right Person at the Right Time.

Page 6: AEM Client Context Customisation

How does is works?

Page 7: AEM Client Context Customisation

Content Personalization with AEM

Page 8: AEM Client Context Customisation

There are three elements involved in personalization :

lLeads/Visitor-Info

lContent/Experience

lRules/Segments

Page 9: AEM Client Context Customisation

Where can i find Lead Information in AEM ?

The Client Context is a mechanism that provides you with certain information about the current page and visitor.

The Client Context includes various Session Stores that contain user data.

Page 10: AEM Client Context Customisation

Adding Client Context To A Page :

Include the Client Context component to the body section of your web pages to enable Client Context.

The path of the Client Context component node is /libs/cq/personalization/components/clientcontext.

<cq:include path="clientcontext" resourceType="cq/personalization/components/clientcontext"/>

Page 11: AEM Client Context Customisation

Session Store :

Session Store contains the user data. A session store can be persisted across browsser sessions,

or can last only for the browser session in which it is created.

Types of Session Stores :

uCQ_Analytics.SessionStoreuCQ_Analytics.PerstistedSessionStore

Page 12: AEM Client Context Customisation

Context Store Components :

A context store component is a CQ component that can be added to Client Context.

Typically, context store components display data from a session store with which they are associated.

Page 13: AEM Client Context Customisation

Lets get our hands dirty in our new play ground a.k.a Client Context

Page 14: AEM Client Context Customisation

Lets create our Session Store first :

The Session Store is a javascript object available both on the author and publish instances. Because we don’t want the

Context Store component to be loaded on the publish instance (remenber it’s only used by editor for simulation), we create

two javascript libraries with the following categories:

lKernel : personalization.stores.kernell Ui : personalization.stores.ui

lStep-1

Page 15: AEM Client Context Customisation

Now As we saw our newly created session store,now we will create UI Part i.e.

Context Store component

lStep-2

Page 16: AEM Client Context Customisation

Create a new CQ component in/apps/customstore/components called

“DataPersonalisation” with the properties :

lsling:resourceSuperType = lcq/personalization/components/contextstores/

lgenericstorepropertieslcomponentGroup = Client Context

lStep-2

lLets create our Context Store component:

Page 17: AEM Client Context Customisation

Now That you have added code that will call render method. Lets create render method.

Create a file <customstore>_ui.js in the ui library:

lStep-2

Page 18: AEM Client Context Customisation

Now That you have created render method.

We need to handle the synchronisation i.e store should be loaded by itself if it is present on client

context page and updates if any updation is to be handled.

lStep-3

Page 19: AEM Client Context Customisation

Create a file init.js.jsp associated with theContext Store component.

This file generates the Javascript code thatinitializes the session store that our context

store component uses.

Remember : The code must set mime type of thefile to “text/javascript”

lStep-4

Page 20: AEM Client Context Customisation

And Its Done

Page 21: AEM Client Context Customisation

Any Questions ?

Page 22: AEM Client Context Customisation
Page 23: AEM Client Context Customisation

lAbout Me

.about-me{name: Ankit Gubrani !Sr. AEM Developer;email-id: [email protected];LinkedIn: in.linkedin.com/in/ankitgubrani;twitter: @ankitgubrani90;blog: codebrains.blogspot.in;website : codebrains.co.in;

}

Page 24: AEM Client Context Customisation

Thank YouPlease contact me at : [email protected]