How to capture data layer values that are updated/set onClick before redirect




I have a scenario where the data layer event object is updated/set after an onClick event. This onClick event also redirects to a new page where the event object is not persisted; How do I build a rule to get the event object values and send them AA?  New to Launch/DTM, any pointers would be helpful.



Accepted Solutions (1)

Accepted Solutions (1)



Turns out the data layer objects was updated after the click event. We resolved this by adding the _sattelite.track() -(with a dynamic label)  to the data layer update and using the Direct Call as a trigger in the Launch rule. Seems to be doing exactly what we need.



Answers (1)

Answers (1)




If I understand correctly, you have an element on your page which, when clicked causes a navigation to another page on the same domain.  There is information about the action which is placed into the data layer and you want to send that info into AA somehow.

If the data layer is truly updated AFTER Launch is notified of the click, you probably don't have much of a chance to get it.

If, however, the data is available at the time of a Launch event rule (triggered by the click), then you have some options.

1). If you want to send this data to AA before you navigate to the next page, there is the 'delay navigation' setting on the click event rule. This lets you delay the navigation for a specified number of milliseconds so that you can get your tracking done.

Screen Shot 2018-07-19 at 2.19.25 PM.png

2).  If you want to send the data on the next page, you're going to need to persist it yourself.  I'd suggest using web storage for this (and probably session storage assuming that you are staying on the same domain and not changing protocol). Here's a rough idea of how this works:

a) If you don't already have data elements for the info that you want to persist, in your click event rule, create a custom condition. Add a bit of Javascript to plug the info into data element(s).

b) Add an action to the rule using the SDI Toolkit (free) extension to persist the info into sessionStorage.

Screen Shot 2018-07-19 at 2.25.33 PM.png

c) On the following page, you can reference the persisted value using a Launch Core Data element of type "Session Storage" using the same value that you used in "Item Key" above.

d) If you want to clear this value, use the SDI Toolkit's "Web Storage Remover" action in the same rule.