Using AEM contextHub as data layer for Analytics



In our case Adobe Analytics is implemented using DTM. To use contextHub as the data layer, we have added the below code at AEM template level.

<sly data-sly-resource="${'contexthub' @ resourceType='granite/contexthub/components/contexthub'}" />

After this we have noticed that "contexthub.kernel.js" was giving a 404 error and we have added the below code at dispatcher level to allow the JS to load:

/0010 { /type "allow" /url "/etc/cloudsettings*" }

Since it was not populating the pagedata store in the contextHub and throwing some more JS errors, we have added the granite utils client library based on suggestion from one of the forum.

<sly data-sly-call="${clientlib.js @ categories='granite.utils'}"/>

Now the pagedata store in the contextHtb is properly getting populated, but granite utils is adding JQuery library(v1.11.2) and it is conflicting with the site's JQuery that is loading separately.

Our front-end UI code is heavily dependent on JQuery ( v3.x.x ) and don't want AEM granite utils to load default JQuery library.

Any pointers on how to achieve the above will be great help!

We are currently using AEM 6.3 SP1  version.