AEM 64 - Content Fragment Insights - Configuring Adobe Launch and Analytics in AEM

Goal


Configure Adobe Launch and Analytics in Experience Cloud to capture AEM Content Fragment Views. For importing the analytics data into AEM check this post

The following steps assume your organization is enabled for Launch and Analytics in Experience Cloud https://experiencecloud.adobe.com


Create Analytics Report Suite

To capture site metrics like Page Views and Content Fragment Views create a Report Suite in Adobe Analytics

1) In your experience cloud click on the Analytics icon and create a new Report suite e.g. ags959eaempopularcfxf



2) Configure list variable - list1 to capture the content fragment paths on page



Configure Adobe Launch

1) In your experience cloud click on Activation > Launch (or https://launch.adobe.com), create a New Property e.g. Content Fragment Insights, add the Adobe Analytics extension and add your report suite id created in step above



2) Add the Adobe Context Hub extension for surfacing data layer to Launch. This custom data layer provides content fragment paths rendered on page for analytics. Add the following data layer schema and data layer root window.eaemData

{
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "page": {
      "type": "object",
      "properties": {
        "pageInfo": {
          "type": "object",
          "properties": {
            "pagePath": {
              "type": "string"
            }
          }
        },
        "contentFraments": {
          "type": "object",
          "properties": {
            "paths": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}




3) With the above data layer schema, json objects like the following can be exposed on your page so launch can understand it

 
 <script>
  window.eaemData = {
         page : {
             pageInfo : {
                 pagePath : "/content/we-retail/language-masters/en"
                },
             contentFraments:{
                 paths : [ "/content/dam/experience-aem/adobe-experience-manager" ]
                }
            }
        }
 </script>


4) Create data element page_path for mapping page path and content_fragments_on_page for mapping content fragment paths from data layer 



5) Add a Rule to load the Analytics library on page load event. It is common to load Analytics at the page bottom, as this allows page to fully load and data layer to be fully populated. The rule is configured to Set Variables Page Name (using data element mapping) and List Variable s.list1 (comma separated values set using custom script collected from the data layer)

for(var i = 0; i < window.eaemData.page.contentFraments.paths.length; i++){
       s.list1 = s.list1 || "";
       s.list1 = s.list1 + ( (s.list1 == "") ? "" : "," ) + window.eaemData.page.contentFraments.paths[i];
}




6) Configure the Analytics Send Beacon action to capture and send data to Analytics for tracking



7) At this point we've configured Analytics in Adobe Launch to capture and track AEM pages and content fragment on the pages; Publish these changes to Development, Stage and Production launch environments (pushing the code to production should happen after thorough testing, here we are doing it for demo purposes... )



8) Following is a launch configuration published to production, we are now ready to use it in AEM sites



AEM - Adobe I/O Integration for IMS

Create an Adobe IMS (Identity Management System) configuration in AEM to integrate with Launch via Adobe I/O

1) Login to AEM and access the IMS configuration screen http://localhost:4502/libs/cq/adobeims-configuration/content/configurations.html, create a configuration, public key certificate...



2) Save the downloaded public key and proceed to Adobe IO console https://console.adobe.io to add the downloaded public key



3) Continue the IO configuration in AEM



AEM and Adobe Launch Integration

1) With the Adobe IO integration now available in AEM, configure AEM to integrate with Launch, allowing us to deploy the Analytics configuration. Navigate to page http://localhost:4502/libs/cq/dtm-reactor/content/configurations.html/conf/we-retail and create a new configuration


2) Quick Publish the site We.Retail to publish the Launch configuration and verify if Launch library is loaded, using chrome developer tools



Import Analytics data for AEM Content Insights

Configure Content Insights to server side import the Analytics data directly into AEM. Launch integration controls the client-side loading of the Analytics library and tracking of impression data, while the Analytics integration controls the server-side import of reporting data from Analytics

1) Navigate to Legacy Cloud Services http://localhost:4502/libs/cq/core/content/tools/cloudservices.html and create an Adobe Analytics configuration



2) Create a Analytics Framework (this is for selecting report suite, mapping context hub variables etc.) In a realistic scenario you'd be selecting two different report suites for author and publish, but for the sake of simplicity we are selecting all to use the same report suite ags959eaempopularcfxf. As we are using a custom data layer (ContextHub extension in Adobe Launch configuration above), we are not mapping any CQ variables to Analytics variables




Analytics Cloud Service in We.Retail

For attaching the cloud service to a site, navigate to properties page of  site, say We.Retail - http://localhost:4502/mnt/overlay/wcm/core/content/sites/properties.html?item=/content/we-retail and select the configuration in Cloud Services tab




Continue reading... for importing the analytics data into AEM check this post

No comments:

Post a Comment