“None” Data Element Storage Duration

In my previous post, we discussed data persistence in both DTM and Adobe Experience Platform Launch. If you haven’t read that post, I recommend reading it before continuing on. Regardless, I’ll recap the existing storage duration options for data elements:

  • Pageview: Data element values are held in a JavaScript variable inside the library. If the user navigates to a new page or refreshes the page, the value is discarded.
  • Session: Data element values are persisted to Session Storage. When the browser tab is closed, the value is discarded.
  • Visitor: Data element values are persisted to Local Storage. The value will be persisted indefinitely.

That’s great, but what if we don’t want the data element value to be stored at all? When dealing with single page applications, this can be fairly common.

As an example, let’s say we’re implementing Adobe Analytics on a single page application and every time a user navigates to a different view we want to send a tracking beacon to the server with some data. When I say “different view” here, I’m specifically talking about the user navigating to a different view within the single page application, not navigating in such a way that the browser loads a completely different HTML document.

Now let’s say we’ve created a data element named product that pulls a value from a data layer on our page — let’s say, from window.dataLayer.product. We’ve selected Pageview for the data element’s storage duration. We’ve set up a rule to send an analytics beacon on each single page application view and include the data element value on the beacon.

Now let’s say that on the first view the user visits, the value of the product data element is CoolPool Pro because the user is looking at the CoolPool Pro product view. We fire off a beacon containing CoolPool Pro as a piece of data. So far, everything is working out fine.

Now the user navigates to our Contact Us view. For our Contact Us view, our app sets window.dataLayer.product to null because the view doesn’t represent a product. When Launch tries to get the value of the product data element, it finds the value of window.dataLayer.product to be null. As outlined in the data persistence post, if the value is null or undefined, the runtime library will then look inside Launch’s data element storage to determine if a value was previously stored for the data element. In our case, data element storage holds the value of CoolPool Pro, because the user technically has not loaded a new HTML document. As a result, the value of CoolPool Pro will be sent on the beacon for the Contact Us view, even though, in this case, CoolPool Pro is unrelated to the Contact Us view. This is not what we want.

The power of none

To solve problems like the one described above, we released the None data element storage duration. Notably, this is now the option selected by default.

None storage duration option.

What does None do? It prevents the Launch runtime library from “remembering” a data element value. In our single page application example above, the value of the product data element will be CoolPool Pro on the first view. In the second view (the Contact Us view), the value of the product data element will end up being whatever we’ve set for the default value of the data element (for example, an empty string).

Remember, Launch first tries to find the data element’s value from its source. In our case, that’s whatever our app has set on window.dataLayer.product. If the value it finds is null or undefined, it then looks for a value in data element storage. Because we’ve chosen the None data element storage duration, no value will be found there. Finally, the data element’s default value will be used, which we will have configured for the data element in the Launch UI.

We hope this makes your life easier, especially as the popularity of single page applications continues its upward trend.