Highlighted

Value not set for custom dimension.

vicente_peris
Visitor
vicente_peris

Hi,

I have a javascript code extensión with a reference to utag_data for a custom dimensión mapped in the Google Universal Analytics' Tag. But when the value is 0 (or false), the Custom Dimension doesn’t appear at the GA hit.

Create new data source (UDO variable - cd_test4) -> Map the new var to GUA tag dimension4 -> Create Javascript Code Extension:

function test(){
 if (something){
   return true;
 }else{
   return false;
  }
}
b.cd_test4 = test();

when "something" is false, the cd4 doesn't appear at the GA hit, when "something" is true, cd4=1;

(Sorry, I don't find the option to attach an image in this formulary).

Is this behaviour correct or am I missing anything?

 

4 REPLIES 4

Value not set for custom dimension.

Tealium Employee

Hi @vicente_peris,

 

This is the expected behavior. UDO params should not be falsy (except for an "". That is okay).

If you want to pass in value of 0 then you should convert it to the string "0" that is not a falsy value.

 

To assert the truthiness of the value in the devtools you can do:

 

var test = function(value) {
return value ? true:false;
}

test(0) // false
test('0') // true

 

 

 

Value not set for custom dimension.

Tealium Employee

@vicente_peris Just to carry on from what @Mauricio has said.

In all templates (as long as they are up-to-date) they have been changed to to no longer use the falsey check. They now use this:

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

 This is basically saying that everything expect undefined and empty strings are allowed to be sent through to the tag template.

 I think it might be worth raising a support ticket at https://community.tealiumiq.com/t5/custom/page/page-id/support-contact-form
Then we can walk through with you and work out what is happening.

Adrian

Ask me anything Tealium related or Javascript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Value not set for custom dimension.

Tealium Employee

Carrying on to what @adrian_browning is saying:

 

The problem is not mapping in a falsy value but setting one using the tag template.  From the tag template

// from u.all function
// a wrapper for setting values on all trackers (you can initialize more than one using the tiq interface) else if (v) { u.o(tracker_name + e, o, v); }

v here would be the value 0. and would not be set.

 

Value not set for custom dimension.

vicente_peris
Visitor
vicente_peris

Hi Mauricio and Adrian,

Thank you for your quick response.

Best