Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

vivek091195
Level 2
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
Brian_Johnson_
Correct answer by
Community Advisor
Community Advisor

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
amgup
Level 7
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.

Brian_Johnson_
Community Advisor
Community Advisor

@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
vivek091195
Level 2
Level 2

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

Brian_Johnson_
Correct answer by
Community Advisor
Community Advisor

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