Quick tip – Passing Data into Launch Rules

If you haven’t yet heard it: In Launch, by Adobe, the _satellite.track() method accepts two parameters: an Event name, plus payload data.

We used to work around this in the past when calling DCRs in DTM, storing the data somewhere in the DOM. My favourite method was the one first shown to me by my colleague Pedro Monjo: create some weirdly-named object within the _satellite object, then attach your data there.

But now, we can pass the data straight into the call, just like that.

This is what we all always wanted!

And here is how you use it.

Payload

The situation: say you’re tracking when a visitor “moves to the next page” within your single-page application. Due to the way SPAs work, you have decided to explicitly call a Rule using _satellite.track().

You want to obviously track which page is loaded, so you want to pass a page name into the call, plus maybe some other information — site section, page language, page author, content tags if the page has some, and so on.

This is what it would look like in your code:

_satellite.track('pseudoPageLoad', pageData);

That was easy!

You can also hard-code the payload, if you want, like so:

_satellite.track('pseudoPageLoad', {'pageName': 'Homepage', 'language': 'es'});

Inside

Inside the Rule, you likely want to pass the data into variables. As if by magic, your payload can be accessed, both in code and as a Data Element.

In code, you have access to event.detail, which holds a structure that reflects what you sent. And if you want to use it directly in an Action, you can access %event.detail%.

If we take the hard-coded example from above, then you can use the following in the field to set Page Name: %event.detail.pageName%, and for — say — eVar2, you type %event.detail.language% into the field.

Note that event.detail contains exactly what you pass into _satellite.track(). If you pass a structure — like in the example above — you get a structure. If you pass a simple string, you’ll get a string.

Awesome, isn’t it?

Btw: I am (pain-) fully aware that Jenn Kunz has written about exactly the same thing (see Direct Call Rules in Launch have a new power: passing additional info in _satellite.track), but I refuse to throw away a perfectly valid article, just because it is no longer useful. Worse: this was originally scheduled for Sep 4, but after my blunder with the other article, I swapped it. Sigh.

Oh: Jenn is right, this works in DTM, too.

Jenn is almost always right, TBH, except when she customizes Analytics.

3 thoughts on “Quick tip – Passing Data into Launch Rules

  1. I’m using a similar approach to do event based tracking. From the website we call CustomEvent with a small DigitalData object as the event data. In DTM and Launch we implement rules on custom-event and can obtain this DigitalData object through event.detail… works like a charm, and now race conditions on data…

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.