GUA Custom dimension not populated when 0

Gold Contributor
Gold Contributor

Hi there

In order to track search results, there we are using a datalayer variable populated with the number of search results returned. This variable is mapped via tag toolbox to a custom dimension of the Google Analytics tag. All is fine if the value is greater than 0: The GA tag is populating the custom dimension as expected. However, if there are no search results, the value is 0 and the custom dimension is not populated at all. We would expect it to be populated with the value of "0".

Small issue with the datalayer variable: The values are set as integers, not strings.

If I understand this article here correctly, this should no longer be an issue however:

The GA tag template is of version tv:7110.20190129 and does contain the section 

if (b[d] !== undefined && b[d] !== "") {

Before I advise devs to change the value to string (which was specified anyway), I would like to be sure that this is the issue.

Many thanks and kind regards...Jean-Marc


GUA Custom dimension not populated when 0

Tealium Employee
Hello Jean-Marc,
The logic that we run within our "mapping" logic is that we do not map "false" values, which would include
  • Empty strings (""),
  • 0,
  • ​Null / undefined,
  • False
In this instance you are trying to map an integer of 0, which would not be mapped due to the logic.
You are correct that sending this value as a string would resolve the issue!