Expand my Community achievements bar.

SOLVED

How can I capture an array of values in Adobe Analytics?

Avatar

Level 2

For my application, I want to capture an array of values. I have set up a listVar in Adobe Analytics with a delimiter of ',' and from my application I am storing the list(options) in local storage like this- option1,option2,option3. I have made a rule corresponding to it in Adobe Experience Launch, and setting variable using Custom Code- 

s.list1 = localStorage.options;

 But when I pull up list1 listVar in Analytics Dashboard, I am getting Unspecified. Please tell me where I am going wrong here.

1 Accepted Solution

Avatar

Correct answer by
Level 8

That certainly tells you how often I work with localStorage in Launch  

 

If you're still having this issue, I'd suggest the following options:

  1. Confirm that the value is actually set in localStorage. You can do this by running the localStorage.getItem("options"); command in the console or checking the storage key directly in your browser's developer tools.
  2. Confirm that the data element is actually getting set by calling _satellite.getVar("YOUR-DATA-ELEMENT-NAME"); directly in the console.
  3. Confirm that the value is included on the analytics calls by evaluating the network request directly, or through any of a number of debugging tools (AEP Debugger, ObservePoint plugin, etc).

 

View solution in original post

4 Replies

Avatar

Level 7

@vivek091195  First you need to check whether localStorage.options is returning values or not. If it is returning values than check what kind of values it is returning. Whether it is giving a single value or all values.

Avatar

Level 8

@vivek091195 - Assuming you've set the localStorage key correctly, you'll need to call localStorage.getItem("options") to retrieve it. For example:

 

localStorage.setItem("options", "one,two,three");
// sets the "options" storage key to "one,two,three"

localStorage.getItem("options");
// retrieves "one,two,three" from the "options" storage key

Avatar

Level 2

@Brian_Johnson_ Thanks for the reply. We can access localStorage items directly using the dot operator. It works exactly like localStoarge.getItem()

Avatar

Correct answer by
Level 8

That certainly tells you how often I work with localStorage in Launch  

 

If you're still having this issue, I'd suggest the following options:

  1. Confirm that the value is actually set in localStorage. You can do this by running the localStorage.getItem("options"); command in the console or checking the storage key directly in your browser's developer tools.
  2. Confirm that the data element is actually getting set by calling _satellite.getVar("YOUR-DATA-ELEMENT-NAME"); directly in the console.
  3. Confirm that the value is included on the analytics calls by evaluating the network request directly, or through any of a number of debugging tools (AEP Debugger, ObservePoint plugin, etc).