To include the component, add the following code to the JSP file of your page component, located just below the body element of your page:
Hi,
I am using AEM 6.0 and trying to customize client context. I am following the URL http://blogs.adobe.com/aemtutorials/2013/07/24/customize-the-client-context/ and have checked out the latest code from codehub and deployed in the local AEM. I opened up the page /content/geometrixx-outdoors/en/men/coats/edmonton-winter.html on Chrome and checked the response on Console. I used console.log statements in the customstore.js to see the output in the Console. The if statement in the checked out code the(inside customstore.js) is not getting called at all. The value of authorizableId being fetched from
var authorizableId = CQ_Analytics.ProfileDataMgr.getProperty("authorizableId");
is anonymous as seen in the Console.log statement. I am not able to see the output in the Console as shown on http://blogs.adobe.com/aemtutorials/2013/07/24/customize-the-client-context/
Is there anything extra that I need to do ?
Solved! Go to Solution.
Views
Replies
Total Likes
You have included the client context correctly. Once you include that line of code, you can use the client context to view data.
Are you following along with the tutorial, or did you install the full code at the very end? I tried doing this tutorial, and if you install the completed code, and try doing step 4, it will only return "Object {}", but if you replace the code inside "customstore.js" with the code from step 2, it will display the correct results in step 4. You need to make sure you have a profile loaded in the client context that is not anonymous for it to display the object data.
Also, when you tried printing "CQ_Analytics.CustomStoreMgr.currentId", the reason that did not work is because that is not a valid option. When you are in the console you can use the intellisense to see a list of methods and variables you can access for your session store.
Views
Replies
Total Likes
Hi,
Is CQ_Analytics object is present in the console ?? If not, then you might have missed including the clientContext in your JSP.
Views
Replies
Total Likes
Hi,
I have included the client context in the body.jsp of the basepage. Is there anything else I need to do to make CQ_Analytics object available ? I also tried to print the value of CQ_Analytics.CustomStoreMgr.currentId in console log but it is printing as it is rather than printing the value.
Views
Replies
Total Likes
AEM newbie wrote...
Hi,
I have included the client context in the body.jsp of the basepage. Is there anything else I need to do to make CQ_Analytics object available ?
From http://docs.adobe.com/docs/en/aem/6-0/develop/personalization/client-context.html#Adding Client%20Context%20To%20A%20Page:
To include the component, add the following code to the JSP file of your page component, located just below the body element of your page:
<cq:include path="clientcontext" resourceType="cq/personalization/components/clientcontext"/> |
Scott
Views
Replies
Total Likes
Thanks for the response. This is how I have included the clientcontext. Do you mean I have to include it some other way ?
<body> <cq:include path="clientcontext" resourceType="cq/personalization/components/clientcontext"/> <div class="wrapper"> <div class="pre-login__container"> <cq:include script="header.jsp"/> <cq:include script="main.jsp"/> </div> </div> <cq:include script="footer.jsp"/> <cq:include path="timing" resourceType="foundation/components/timing"/> <cq:include path="cloudservices" resourceType="cq/cloudserviceconfigs/components/servicecomponents"/> </body>
Views
Replies
Total Likes
You have included the client context correctly. Once you include that line of code, you can use the client context to view data.
Are you following along with the tutorial, or did you install the full code at the very end? I tried doing this tutorial, and if you install the completed code, and try doing step 4, it will only return "Object {}", but if you replace the code inside "customstore.js" with the code from step 2, it will display the correct results in step 4. You need to make sure you have a profile loaded in the client context that is not anonymous for it to display the object data.
Also, when you tried printing "CQ_Analytics.CustomStoreMgr.currentId", the reason that did not work is because that is not a valid option. When you are in the console you can use the intellisense to see a list of methods and variables you can access for your session store.
Views
Replies
Total Likes
Hey thanks again for your response. Really appreciate it. I pulled the code from git and installed it, I have loaded the profile and finally able to see the value of authorizableId. But I am not sure how to go about CQ_Analytics.CustomStoreMgr.currentId and CQ_Analytics.CustomStoreMgr.initialized. What I exactly mean is what do I need to make these work or use something else.
Views
Replies
Total Likes
I replied to your other post. I hope that it helps you.
Views
Replies
Total Likes
Is there a way to get client context data in AEM component (instead of segments)...appreciate any help in this regard
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies