Hi, all.
I need to use information from a JSONP Store to resolve segments, but it seems that I am missing some important step. The steps I am following were taken from http://dev.day.com/docs/en/cq/current/developing/client_context_detail.html, but I have to confess that I got lost at some point.
Here are the steps:
[img]client-context-editing.png[/img]
[img]client-context-on-page.png[/img]
I do believe (maybe it's even obvious) that I am missing something before the last step. Should I have some code to load/refresh the information of the JSONP store on the page, or to register this store? Where can I find a sample?
Once this information is loaded, I think I'll be able to use that to resolve my segments. But now I am stuck on this phase.
Any help will be greatly appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
If 5.6.1 there was a bug. Overlay [1] & line 30 replace to have [2]. If does not help file a daycare & will help you out.
[1] /libs/cq/personalization/components/contextstores/jsonpstore/init.js.jsp
[2] CQ_Analytics.JSONPStore.registerNewInstance("<%= xssAPI.getValidJSToken(store, "") %>", "<%= xssAPI.encodeForJSString(serviceURL, "") %>", {});
Views
Replies
Total Likes
Have you included the client context libraries in your page header? That should be all that you need to do if you are using an out-of-the-box client context component.
<cq:include path=
"clientcontext"
resourceType=
"cq/personalization/components/clientcontext"
/>
FYI, An example of using JSONP Store component is on this page:
scott
Views
Replies
Total Likes
If 5.6.1 there was a bug. Overlay [1] & line 30 replace to have [2]. If does not help file a daycare & will help you out.
[1] /libs/cq/personalization/components/contextstores/jsonpstore/init.js.jsp
[2] CQ_Analytics.JSONPStore.registerNewInstance("<%= xssAPI.getValidJSToken(store, "") %>", "<%= xssAPI.encodeForJSString(serviceURL, "") %>", {});
Views
Replies
Total Likes
I will walk through this doc and see if i can reduplicate the issue you encountered. It should work as written in the doc.
Views
Replies
Total Likes
Also -- there was a comment in the docs (See below). Did you add this code to your sample?
Views
Replies
Total Likes
Hi, Sham HC.
Sorry for the long delay for posting back in here. Your suggestion worked perfectly, as I am using AEM 5.6.1. Thanks A LOT for ending my suffering :)
But the bad part is that for fixing it I'll need to change a core file of AEM.
Is this fix part of a hotfix or something like that?
Regards and thanks again.
EDIT - just to make it clear for someone that may read this topic in future: after applying the fiz on AEM code suggested above, I just needed to drag & drop a a) JSONPStore to the client context, b) configure it with the service URL and variables to be retrieved, and on the segments edit page c) drag & drop e Generic Properties component to the segment edit, d) find my store (note: the name that is generated automatically is not friendly, something like "localhost_4502", and I'd like to be able to edit it...) and work with its variables.
The only code I needed to include on my template was a line <cq:include path="clientcontext" resourceType="cq/personalization/components/clientcontext"/>, no custom JavaScript added to the page.
Views
Replies
Total Likes
Hi, smacdonald2008.
Thanks for your help.
I included this taglib declaration on my JSPs and it didn't help, but from what I could understand the personalization: taglib is used for displaying store information on client context when we customize this information display.
But there may be a huge between my understanding and the actual role of this tag :)
Shouldn't I include some CQ_Analytics.<function call> on my pages to initialize/instantiate the store?
Views
Replies
Total Likes
Yes -- the CQ_Analytics.<function> is used in this use case. This code is shown in the doc:
<%
@page
contentType=
"text/javascript;charset=utf-8"
%><%
%><%
@include
file=
"/libs/foundation/global.jsp"
%><%
log.info(
"***** initializing geolocstore ****"
);
String store =
"locstore"
;
%>
var locstore = CQ_Analytics.StoreRegistry.getStore(
"<%= store %>"
);
if
(!locstore){
locstore = CQ_Analytics.JSONPStore.registerNewInstance(
"<%= store %>"
,
"<%= jsonpurl %>"
,{});
}
<% log.info(
" ***** done initializing geoloc ************"
); %>
Views
Replies
Total Likes
Views
Likes
Replies