Configuring Adobe Analytics and Acoustic Exchange
As a part of Acoustic Personalization integration with your Single-Page Application (SPA) or Multi-Page Application (MPA), you must configure a tagging and analytics engine such as Adobe Analytics.
Attention: Adobe will sunset Dynamic Tag Management (DTM) in the near future. As a part
of this process, new Web properties cannot be created in DTM. The procedure described in this topic
can only be used if you already have a Web property created in DTM.
Prerequisites
Ensure that the following prerequisites are fulfilled.
- Web property is available in Adobe DTM.
- The Production Embed Code snippet of the Web property is added to your channel web pages.
- A tool is added for the Web property.
- Adobe Analytics is registered as an endpoint in Acoustic Exchange. For more information, see Registering tagging libraries in Acoustic Exchange
- Your channel is using Acoustic Personalization Library version < 1.2.0.
Step 1: Get the Acoustic Exchange Capture Enablement Key
- In Acoustic Exchange, navigate to Acoustic Exchange Capture from the Tools menu.
- Click Enablement Key icon, and copy the following lines of code that
contain the enablement key and paste them in a notepad file. These lines of code will be required in
Step 2.
<script type="text/javascript" src="//commercelibs.ibm.com/common/ubxCapture.js"> </script> <script type="text/javascript"> ubxCapture.setID("<<UBX Capture Enablement Key>>"); </script>
Step 2: Create new rule
Log in to Adobe Analytics Dashboard and perform this step onwards.
- Adding Acoustic Exchange Enablement Key
-
- In the Adobe Analytics Dashboard, click the Web property that you created in the prerequisites.
- Go to
- Click Create New Rule button.
- Provide a name for the rule.
- In the Conditions, select Trigger rule at: Top of Page
- Go to JavaScript / Third-Party Tags tab.
- Select the Sequential HTML option.
- Click Add new script button.
- Provide a name for the tag.
- Select Type: Sequential HTML
- Add the Acoustic Exchange enablement key code that you copied in Step 1.
<script type="text/javascript" src="//commercelibs.ibm.com/common/ubxCapture.js"> </script> <script> var channelID ="<<channel tenant ID>>"; ubxCapture.setTenantID("WRTP",channelID); ubxCapture.setTenantID("AA","<<UBX Events only authentication key for Adobe Analytics Endpoint>>"); </script> <script type="text/javascript"> ubxCapture.setID("<<UBX Capture Enablement Key>>"); </script>- The highlighted lines of code do not exist in the enablement key and should be added manually.
- Replace the string <<channel tenant ID>> with the channel tenant ID of your channel.
- The variable channelID specified here must be the same as the value for Path attribute of Data element that you will create in Step 3.
- For more information about <<UBX Events only authentication key for Adobe Analytics Endpoint>>, see the section "Configure tagging and analytics library in UBX Capture" in the topic Configuring Acoustic Personalization in UBX Capture
- Click Save. Next, click Save Rule.
The new rule is displayed in Page Load Rules tab.
- Adding personalization script
- Similarly, create another new rule for the Web property with the following parameters.
- Click Create New Rule button.
- Provide a name for the rule.
- In the Conditions, select Trigger rule at: Onload
- Click JavaScript / Third-Party Tags tab.
- Click Add new script button.
- Provide a name for the tag.
- Select Sequential JavaScript
- Select the Execute Globally check box.
-
Add the following code snippet.
For Multi-Page Application (MPA), add the following code snippet.var ubxEvents = []; var identifiersMapper = []; var attributesMapper = []; ibm_ubx.registerCallback("WRTP", function (eventPayload){ if (eventPayload) { ubxEvents.push(eventPayload); } }); //Personalization if (wrtp != undefined || wrtp != {}) { const WRTP = wrtp.ole.JsWRTP.create(); const zoneId = "<<ZoneID of the zone registered for personalization>>"; WRTP.getContentId(zoneId) .then((contentId) => { let zoneArea = WRTP.getZoneArea(zoneId); if (contentId !== 'DCIDNF404') { if (zoneArea) { //Add code to render personalized content zoneArea.style.opacity = 1; } else { console.log("WRTP: ${zoneId} personalized and not displayed"); } } else { if (zoneArea) { //Add code to render default content zoneArea.style.opacity = 1; } else { console.log("WRTP: ${zoneId} not personalized and not displayed"); } } }) .catch((error) => { console.log("WRTP: Error occurred during zone personalization"); }); } else { console.log("WRTP: Error in loading the online-engine library."); }- In the code snippet, replace the text <<ZoneID>> with the registered zone ID.
- This code snippet is for a single zone. For multiple zones, see the example code snippet in the topic Configuring the zones on MPA
For Single-Page Application (SPA), add the following code snippet.
Next, add the personalization code for SPA, as described in the topic Configuring the zones of Angular SPAvar ubxEvents = []; var identifiersMapper = []; var attributesMapper = []; ibm_ubx.registerCallback("WRTP", function (eventPayload){ if (eventPayload) { ubxEvents.push(eventPayload); } }); - Click Save.
- Click Save Rule.
Step 3: Creating Data elements
Perform the following steps to create a Data Element to send the Channel Tenant with each Adobe Analytics event.
- Go to Data Elements tab.
- Click Create New Data Element.
- In the Name field, enter the name for Channel Tenant ID. For example, Channel Tenant ID
- Select Type: JS Object
- In the Path field, enter: channelID
- The Path value must be the same as the variable provided in the code snippet of Step 2. In this case, the value is channelID.
- Select Default Value as: - (blank)
- Select Remember this value for: Session
- Click Save.
Step 4: Configure events
Perform the following steps to modify the Adobe Analytics events and add the Data Element to send
the Channel Tenant with each of the events to Acoustic Exchange.
- Go to Event Based Rules tab.
- Click Create New Rule.
- In the Name field, provide the name event name, for example ProductView.
- Go to , select Event type: Click
- In the Element Tag or Selector text box under Tag section, enter the ID and class of the HTML element (for example, a button) for which you want to capture the event.
- Go to Adobe Analytics
- Select s.tl(); - does NOT increment a pageview
- Select Link Tracking: Custom Link
- Provide a name in the Link Name field.
- Go to eVars section.
- Select a name for the eVar. For example: evar1
- In the Set as type %. A list of data elements appears. Select a data element. For example, %Channel Tenant ID%
- Click Save eVar.
- Go to Props section.
- Select a name for the Prop. For example: prop1
- In the Set as field, type %. A list of data elements appears. Select a data element. For example, %Channel Tenant ID%
- Click Save Prop.
- Go to JavaScript/Third-Party Tag tab.
- Select Sequential JavaScript .
- Click Add New Script button.
- Provide a name for the tag.
- Select Type as Sequential JavaScript
- Important! Ensure that Execute Globally check box is clear.
- Add the following code snippet. This is an example snippet for ProductView
event.
attributesMapper.push({ "adobeName": "prop1", "ubxName": "channeltenantId", "type": "string" }) adobe_ubx.sendEventFromJSONPayload(s, identifiersMapper, "ibmproductView", attributesMapper);
- Similarly, add the highlighted line of code for all the events.
For more information about Adobe Analytics events, see Subscribing to Adobe Analytics events in Acoustic Exchange
- Save the rule.
Step 5: Approve and Publish the rules
To approve the rules, complete the following steps.
- Go to Approvals tab.
- Click Approve for all the rules.
To publish the approved rules, complete the following steps.
- Go to Overview tab.
- Click Publish Queue button.
- Click Publish Selected button.
References
For detailed information about configuring Adobe Analytics with Acoustic Exchange, see this IBM Knowledge Center documentation.