Code explanation

Look at the adobeDataLayer array (which stores events happening on your webpage).

Make a copy of the array using.slice() so the original is not changed.

Reverse the order of the events to check the newest events first.

Find the first event (starting from the newest) where event.event is exactly “assetClassSelection.”

If found, go into that event’s xdm data and get the value from FinancialInterest.PreferredFinancialInstrument.

If nothing is found, return the string “undefined,”

Create Rule

The Rule Builder in Adobe Experience Platform Tags lets you define when and how specific actions should run on your website based on user behavior or events.

  • Create a Rule named Send Preferred Financial Instrument. This rule contains an event and an action

  • Create an event configuration named Preferred Asset Class Selected as shown below. This event listens to assetClassSelection events.
    rule-event

  • Create an Action to send the updated XDM schema to AEP
    send-event

  • Your final rule should look like below
    final-rule

Build and deploy the AEP Tags

Create a new library and add all the modified resources to it, as illustrated in the screenshots below.

Add library

new-library

Create a library

In the create library screen specify the library name and the environment.
You need to add all the changed resources to this library
tag-library

Then click on the Save and Build to Development button to build the library