Highlighted

How to define counter value in data layer

Silver Contributor
Silver Contributor

How to define counter value in data layer

 

metrics1: 1

 

or 

 

metrics1: "1"

 

or any other number value.

1 REPLY 1
Highlighted

How to define counter value in data layer

Tealium Employee

It's usually better to default everything to a string value (e.g. "1") since most of our templates expect strings. Javascript is also loose enough where you can increment and convert back to a string in one swoop:

 

b['metrics1'] = (++b['metrics1']) + ""; //increment by 1