In this 5 part video series, we walk through the setup and configuration of Asset Insights for Experience Manager deployed via Adobe Launch.
Asset Insights Overview. Install Core Components, Sample Image Component and other content packages to get your environment ready.
Make sure to download the latest version of Core Components for your implementation.
The video uses Core Components v2.2.2 which not no longer the latest version; be sure to use the latest version before you proceed to the next section.
Enhancements to Core Components and using proxy component (Sample Image Component) for Asset Insights. Editing the content page template policies to enable sample image component for reference site.
Image Core Component includes the capability to disable UUID tracking by disabling tracking of asset’s UUID (unique identifier value for a node created within JCR)
Core Image component uses data-asset-id attribute within the parent <div> of an image tag to enable/disable this feature. Proxy Component overrides the core component with the following changes.
data-aem-asset-id=‘image.UUID’ and data-trackable=‘true’ are the key attributes that needs to be present for Asset Impressions. For Asset Click Insights, in addition to the above data attributes present at the <img> tag, the parent <a> tag must have a valid href value.
Report suite with real-time data collection is created for asset tracking. AEM Assets Insights configuration is set up using Adobe Analytics credentials.
Real Time data collection and AEM Asset Reporting needs to be enabled for your Adobe Analytics Report Suite. Enabling AEM Asset Reporting reserves analytics variables for tracking asset insights.
For AEM Assets Insights configuration you need the following credentials
Adding Adobe Analytics Extension, Creating Page Load rules and Integrating AEM with Launch with Adobe IMS technical account.
Make sure to replicate all your changes from author instance to publish instance.
//For AEM 6.3
<script type="text/javascript" src="http://localhost:4503/etc/clientlibs/foundation/assetinsights/pagetracker.js"></script>
//For AEM 6.4
<script type="text/javascript" src="http://localhost:4503/etc.clientlibs/dam/clientlibs/assetinsights/pagetracker.js"></script>
Page tracker implements two call backs (registered in asset-embed-code)
Finally, Pagetracker implements an initialization function as.
/*
* AEM Asset Insights
*/
var sObj = window.s;
_satellite.notify('in assetAnalytics customInit');
(function initializeAssetAnalytics() {
if ((!!window.assetAnalytics) && (!!assetAnalytics.dispatcher)) {
_satellite.notify('assetAnalytics ready');
/** NOTE:
Copy over the call to 'assetAnalytics.dispatcher.init()' from Assets Pagetracker
Be mindful about changing the AppMeasurement object as retrieved above.
*/
assetAnalytics.dispatcher.init(
"", /** RSID to send tracking-call to */
"", /** Tracking Server to send tracking-call to */
"", /** Visitor Namespace to send tracking-call to */
"", /** listVar to put comma-separated-list of Asset IDs for Asset Impression Events in tracking-call, e.g. 'listVar1' */
"", /** eVar to put Asset ID for Asset Click Events in, e.g. 'eVar3' */
"", /** event to include in tracking-calls for Asset Impression Events, e.g. 'event8' */
"", /** event to include in tracking-calls for Asset Click Events, e.g. 'event7' */
sObj /** [OPTIONAL] if the webpage already has an AppMeasurement object, please include the object here. If unspecified, Pagetracker Core shall create its own AppMeasurement object */
);
sObj.usePlugins = true;
sObj.doPlugins = assetAnalytics.core.updateContextData;
}
else {
_satellite.notify('assetAnalytics not available. Consider updating the Custom Page Code', 4);
}
})();
/*
* AEM Asset Insights
*/
document.querySelectorAll('[data-aem-asset-id]').forEach(function(element) {
assetAnalytics.core.assetLoaded(element);
var parent = element.parentElement;
if (parent.nodeName == "A") {
parent.addEventListener("click", function() {
assetAnalytics.core.assetClicked(this)
});
}
});
//Launch Build Info
_satellite.buildInfo
//Enables debug messages
_satellite.setDebug(true);
//Asset Insight JS Object
assetAnalytics
//List of trackable images
document.querySelectorAll(".cmp-image__image");
Two Google Chrome browser extensions are referenced in the video as ways to debug Analytics. Similar extensions are available for other browsers as well.
It is also possible to switch DTM into debug mode with the following Chrome Extension: Launch and DTM Switch. This makes it easier to see if there are any errors related to DTM deployment. In addition, you can manually switch DTM to debug mode via any browsers developer tools -> JS Console by adding the following snippet:
Configuring AEM Asset Reporting Sync Job Scheduler and Assets Insights Report