Expand my Community achievements bar.

Data Element values not coming up

Avatar

Level 7

I have webpages as Single page application (SPA) without refresh. I am getting adobe hit for every URL change with the help of History Change event type. Now I am trying to capture some of the data layer objects on every URL change. For this I created seprate data elements and mapped them to evars & enabled a DOM ready event type rule in launch however, I am unable to get anything in the debugger (looks like DOM reday is not right event type). Any suggestions on this?

 

I also tried changing it to history change but I am facing timing issue. The values of data elements are populating later on, which means data elements of page A are populating when page B or C are clicked. 

1 Reply

Avatar

Community Advisor

Best practice (especially) for SPA sites is to work with the site developers to implement an event driven data layer. 

 

Take a look at window.appEventData on https://orbitalprovisions.searchdiscovery.com/collections/frontpage/products/lego-women-of-nasa as an example. 

 

In this example, there are four events that are pushed tho the EDDL: 

Page Load Started (provides the page object). 

User Detected (provides the user object)

Product Viewed (provides the product object (array). 

Page Load Completed - provides no data but is used to trigger the s.t()

 

As each of first three events are pushed, Launch rules are triggered which set variables on the s object. 

The push of Page Load Completed sends the beacon, and runs the clear vars action.