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 to capture Array as eVar variable

sammaccoll
Level 1
Level 1

Inside our digitalData datalayer we have an Array which captures all the Javascript errors that happen on the page and list them inside it.

 

How can I then take this array and split it up to pass to an eVar? I'm fine doing it for a single javascript varaiable within the dataLayer, just unsure of how to capture each line inside the Array,

1 Accepted Solution
jeff_bloomer
Correct answer by
Level 8
Level 8

Hi @sammaccoll,

Because you are dealing with longer character strings with errors, I would MOST recommend using a listvar, as each value within a listvar has a maximum character length of 255 characters.  listprops are OK as long as you don't receive a set of values exceeding 100 characters.  This is the most differing characteristic of listprops vs. listvars.  In both cases you are limited to just 3 of each.

In the first two cases, you have the ability to use Classification Rules to align your errors with meaningful buckets (e.g., Error1= login issues, Error2=first or last name, Error3=email address, etc.).

 

You also have the option to send a delimited value into a single eVar; however, you will again be limited, but this time by a maximum of 255 characters for the entire string.  Also, if you have a variable number of errors, it can become more challenging to appropriately apply Classification Rules.


All three of the recommendations provided by @amgup@Brian_Johnson_, and @yuhuisg provide good solutions.  I just wanted to make sure you had some of the additional info behind them as well.  In fact, I just found an article that also provides some additional input for you to review:
https://terrynwinter.com/adobe-analytics-list-vars-and-evars-with-classification/ 


Best wishes!

View solution in original post

0 Replies
Brian_Johnson_
Community Advisor
Community Advisor

@sammaccoll - I'll second @amgup on the listVar recommendation.

 

A super simple example would be something like the following. (Obviously, you'll need to include any necessary error handling and/or checks to make sure the array is populated...)

// collect all of the error messages
var my_errors = [
  'something bad happened',
  'a terrible thing has occurred',
  'you are not going to believe what just happened'
];

// join using the delimiter specified in the listVar config
s.list1 = my_errors.join('|');

In the Adobe interface, pull up the corresponding report for your listVar and you should see each of the specified errors as individual line items.

yuhuisg
Community Advisor
Community Advisor

listVars would be great in this case, but keep in mind that you only have three listVars per report suite.

Since these are JavaScript errors that (probably) won't get cross-referenced with other eVars, you might want to use listProps instead to conserve your listVars. See the "List props" section at prop | Adobe Analytics.

jeff_bloomer
Correct answer by
Level 8
Level 8

Hi @sammaccoll,

Because you are dealing with longer character strings with errors, I would MOST recommend using a listvar, as each value within a listvar has a maximum character length of 255 characters.  listprops are OK as long as you don't receive a set of values exceeding 100 characters.  This is the most differing characteristic of listprops vs. listvars.  In both cases you are limited to just 3 of each.

In the first two cases, you have the ability to use Classification Rules to align your errors with meaningful buckets (e.g., Error1= login issues, Error2=first or last name, Error3=email address, etc.).

 

You also have the option to send a delimited value into a single eVar; however, you will again be limited, but this time by a maximum of 255 characters for the entire string.  Also, if you have a variable number of errors, it can become more challenging to appropriately apply Classification Rules.


All three of the recommendations provided by @amgup@Brian_Johnson_, and @yuhuisg provide good solutions.  I just wanted to make sure you had some of the additional info behind them as well.  In fact, I just found an article that also provides some additional input for you to review:
https://terrynwinter.com/adobe-analytics-list-vars-and-evars-with-classification/ 


Best wishes!

View solution in original post

jantzen_belliston-Adobe
Level 10
Level 10

Thanks for providing some additional context @jeff_bloomer! Love how much detail you provided. 

 

@sammaccoll - Do any of the answers provided answer your initial question? If so, can you select one of them as the correct answer? If none of the answers already provided answer your question, can you provide additional information to better help the community solve your question?

jeff_bloomer
Level 8
Level 8

@jantzen_belliston-Adobe Always happy to help out on these things where I can. 😊 

I've been down this path plenty of times on my own, and it's a lot easier for me to understand things if I have the whole picture.  My goal in answering, oftentimes, is also to add to the knowledgebase within these questions so they contain the most robust information, where possible, so that other people are able to understand the context without the need to go searching for more.

sammaccoll
Level 1
Level 1

Thank you very much for all your replies, the detail from @jeff_bloomer really helped explain it more, but thanks very much to @amgup @Brian_Johnson_ @yuhuisg 

 

I ended up using a combination of all your messages, but could only pick one solution. Thanks everyone!